Skip to content

Commit

Permalink
Fix acolite windows bug (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs authored Sep 15, 2024
1 parent d522815 commit 6766919
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hypercoast/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ def get_formatted_current_time(format_str="%Y-%m-%d %H:%M:%S"):
formatted_time = current_time.strftime(format_str)
return formatted_time

acolite_dir_name = os.path.split(os.path.dirname(acolite_dir))[-1]
acolite_dir_name = os.path.split(acolite_dir)[-1]
acolite_exe = "acolite"
if acolite_dir_name.endswith("win"):
acolite_exe += ".exe"
Expand All @@ -922,6 +922,7 @@ def get_formatted_current_time(format_str="%Y-%m-%d %H:%M:%S"):
os.makedirs(out_dir)

acolite_exe_path = os.path.join(acolite_dir, "dist", "acolite", acolite_exe)
acolite_exe_path = acolite_exe_path.replace("\\", "/")

acolite_cmd = [acolite_exe_path, "--cli"]

Expand All @@ -932,8 +933,10 @@ def get_formatted_current_time(format_str="%Y-%m-%d %H:%M:%S"):
lines.append("## ACOLITE settings")
lines.append(f"## Written at {get_formatted_current_time()}")
if input_file is not None:
input_file = input_file.replace("\\", "/")
lines.append(f"inputfile={input_file}")
if out_dir is not None:
out_dir = out_dir.replace("\\", "/")
lines.append(f"output={out_dir}")
if polygon is not None:
lines.append(f"polygon={polygon}")
Expand All @@ -959,7 +962,7 @@ def get_formatted_current_time(format_str="%Y-%m-%d %H:%M:%S"):

lines.append(f"runid={get_formatted_current_time('%Y%m%d_%H%M%S')}")
settings_filename = f"acolite_run_{get_formatted_current_time('%Y%m%d_%H%M%S')}_settings_user.txt"
settings_file = os.path.join(out_dir, settings_filename)
settings_file = os.path.join(out_dir, settings_filename).replace("\\", "/")
with open(settings_file, "w", encoding="utf-8") as f:
f.write("\n".join(lines))
acolite_cmd.extend(["--settings", settings_file])
Expand Down

0 comments on commit 6766919

Please sign in to comment.