Skip to content

Commit

Permalink
Move default dir_ref and folder creation
Browse files Browse the repository at this point in the history
This needs to happen after setting the library root, not in init. For lbl-srg#393
  • Loading branch information
marcusfuchs committed Nov 18, 2020
1 parent 970954b commit 707869c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions buildingspy/development/regressiontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,7 @@ def __init__(
self._rootPackage = os.path.join(self._libHome, 'Resources', 'Scripts', 'Dymola')

# Set the reference results directory
if dir_ref is None:
self.dir_ref = os.path.join(
self._libHome, 'Resources', 'ReferenceResults', 'Dymola'
)
else:
self.dir_ref = dir_ref
if not os.path.exists(self.dir_ref):
os.makedirs(self.dir_ref)
self.dir_ref = dir_ref

# Set the tool
if tool in ['dymola', 'omc', 'optimica', 'jmodelica']:
Expand Down Expand Up @@ -437,6 +430,13 @@ def setLibraryRoot(self, rootDir):
self._rootPackage = os.path.join(self._libHome, 'Resources', 'Scripts', 'Dymola')
self.isValidLibrary(self._libHome)

if self.dir_ref is None:
self.dir_ref = os.path.join(
self._libHome, 'Resources', 'ReferenceResults', 'Dymola'
)
if not os.path.exists(self.dir_ref):
os.makedirs(self.dir_ref)

def useExistingResults(self, dirs):
""" This function allows to use existing results, as opposed to running a simulation.
Expand Down

0 comments on commit 707869c

Please sign in to comment.