Skip to content

Commit a1ea59e

Browse files
authored
path fix (#387)
1 parent e33ffe6 commit a1ea59e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scripts/generate_cargo.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,17 @@ def main():
292292
pin_dependencies(toml_data, lockfile_path)
293293

294294
# Write the updated data to the output TOML file
295-
with open(args.output, "w") as f:
295+
output_filepath_abs = os.path.abspath(args.output)
296+
297+
with open(output_filepath_abs, "w") as f:
296298
f.write("# This file is auto generated. See generate_cargo.py\n")
297299
f.write(toml_data.as_string())
298300

299301
# Generate lockfile using Cargo
302+
output_dir = os.path.dirname(args.output) or os.getcwd()
300303
try:
301-
subprocess.run(["cargo", "generate-lockfile"], cwd=os.path.dirname(args.output), check=True)
302-
print(f"Generated Cargo.lock in {os.path.dirname(args.output) or '.'}")
304+
subprocess.run(["cargo", "generate-lockfile"], cwd=output_dir, check=True)
305+
print(f"Generated Cargo.lock in {output_dir or '.'}")
303306
except subprocess.CalledProcessError as e:
304307
print(f"Error generating Cargo.lock: {e}")
305308
return 1

0 commit comments

Comments
 (0)