Skip to content

Commit

Permalink
Merge pull request #3393 from architecture-building-systems/3391-temp…
Browse files Browse the repository at this point in the history
…-directory

Use temp directory created by python
  • Loading branch information
reyery committed Sep 26, 2023
2 parents 7a5fd3c + 3f51678 commit 33397cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cea/inputlocator.py
Expand Up @@ -34,6 +34,8 @@ def __init__(self, scenario, plugins=None):
self._wrap_locator_methods(plugins)
self.plugins = plugins

self._temp_directory = None

def __getstate__(self):
"""Make sure we can pickle an InputLocator..."""
return {
Expand Down Expand Up @@ -1107,7 +1109,9 @@ def get_timeseries_plots_file(self, building, category=''):
# OTHER
def get_temporary_folder(self):
"""Temporary folder as returned by `tempfile`."""
return tempfile.gettempdir()
if self._temp_directory is None:
self._temp_directory = tempfile.TemporaryDirectory()
return self._temp_directory.name

def get_temporary_file(self, filename):
"""Returns the path to a file in the temporary folder with the name `filename`"""
Expand Down

0 comments on commit 33397cd

Please sign in to comment.