Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how ModelicaPaths are built so they also work on Windows computers #590

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions geojson_modelica_translator/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def files_dir(self):
if self.root_dir is None:
return self.files_relative_dir
else:
return os.path.join(self.root_dir, self.name)
return f"{self.root_dir}/{self.name}"

@property
def resources_relative_dir(self):
Expand All @@ -93,7 +93,7 @@ def resources_relative_dir(self):

:return: string, relative resource's data path
"""
return os.path.join("Resources", "Data", self.name)
return f"Resources/Data/{self.name}"

@property
def scripts_relative_dir(self, platform='Dymola'):
Expand All @@ -102,7 +102,7 @@ def scripts_relative_dir(self, platform='Dymola'):

:return: string, relative scripts path
"""
return os.path.join("Resources", "Scripts", self.name, platform)
return f"Resources/Scripts/{self.name}/{platform}"

@property
def files_relative_dir(self):
Expand All @@ -120,7 +120,7 @@ def resources_dir(self):
if self.root_dir is None:
return self.resources_relative_dir
else:
return os.path.join(self.root_dir, self.resources_relative_dir)
return f"{self.root_dir}/{self.resources_relative_dir}"

@property
def scripts_dir(self):
Expand All @@ -133,7 +133,7 @@ def scripts_dir(self):
if self.root_dir is None:
return self.scripts_relative_dir
else:
return os.path.join(self.root_dir, self.scripts_relative_dir)
return f"{self.root_dir}/{self.scripts_relative_dir}"


# This is used for some test cases where we need deterministic IDs to be generated
Expand Down
2 changes: 1 addition & 1 deletion tests/geojson_modelica_translator/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUp(self):
def test_properties(self):
mp = ModelicaPath("Loads", root_dir=None)
self.assertEqual(mp.files_dir, "Loads")
self.assertEqual(mp.resources_dir, os.path.join("Resources", "Data", "Loads"))
self.assertEqual(mp.resources_dir, "Resources/Data/Loads")

def test_single_sub_resource(self):
root_dir = os.path.join(self.output_dir, "modelica_path_01")
Expand Down