Skip to content

Commit

Permalink
Fix #25
Browse files Browse the repository at this point in the history
* A missing (network) directory is now ignored
  • Loading branch information
dkratzert committed Jan 29, 2024
1 parent c2c0569 commit 6e1d832
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/structurefinder/misc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ def save_current_work_dir(self, dir: str) -> None:

def load_last_workdir(self) -> str:
self.settings.beginGroup('WorkDir')
lastdir = self.settings.value("dir", type=str)
if not Path(lastdir).exists():
lastdir = './'
last_dir = self.settings.value("dir", type=str)
self.settings.endGroup()
return lastdir
last_dir = self._find_dir(last_dir)
return last_dir

def _find_dir(self, last_dir):
try:
if not Path(last_dir).exists():
last_dir = './'
except OSError:
last_dir = './'
return last_dir

def save_current_index_dir(self, dir: str) -> None:
"""
Expand All @@ -40,9 +47,8 @@ def save_current_index_dir(self, dir: str) -> None:
def load_last_indexdir(self) -> str:
self.settings.beginGroup('IndexDir')
lastdir = self.settings.value("dir", type=str)
if not Path(lastdir).exists():
lastdir = './'
self.settings.endGroup()
lastdir = self._find_dir(lastdir)
return lastdir

def save_ccdc_exe_path(self, path: str) -> None:
Expand Down

0 comments on commit 6e1d832

Please sign in to comment.