Skip to content

Commit

Permalink
Better checking the ogs_root in the run command
Browse files Browse the repository at this point in the history
  • Loading branch information
MuellerSeb committed Apr 24, 2019
1 parent 167fb2c commit bffa41a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ogs5py/ogs.py
Expand Up @@ -857,6 +857,20 @@ def run_model(
return False
else:
ogs_root = check_ogs
else:
if sys.platform == "win32" and ogs_root[-4:] == ".lnk":
print("Don't use file links under windows...")
return False
elif os.path.islink(ogs_root):
ogs_root = os.path.realpath(ogs_root)
if os.path.exists(ogs_root):
if not os.path.isfile(ogs_root):
ogs_root = os.path.join(ogs_root, ogs_name)
else:
print("The given ogs_root does not exist...")
return False
# use absolute path since we change the cwd in the ogs call
ogs_root = os.path.abspath(ogs_root)

# create the command to call ogs
args = [ogs_root, self.task_id]
Expand All @@ -879,7 +893,7 @@ def run_model(
args.append("--output-directory")
args.append(output_dir)
else:
output_dir = self.task_root
output_dir = os.path.abspath(self.task_root)

# prevent eraising files...
if not save_log:
Expand Down

0 comments on commit bffa41a

Please sign in to comment.