Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save project custom file paths as relative #126

Closed
alexhroom opened this issue Jan 29, 2025 · 3 comments · Fixed by #127
Closed

Save project custom file paths as relative #126

alexhroom opened this issue Jan 29, 2025 · 3 comments · Fixed by #127

Comments

@alexhroom
Copy link
Collaborator

alexhroom commented Jan 29, 2025

Currently, custom files use absolute paths, which means that the project.json files are not portable. They should be changed so that the custom file paths saved in the project.json file are relative to the file save location, e.g. using Path.relative_to

@StephenNneji
Copy link
Contributor

The current save methods expect path to be provided, I think it would be nice to have the path be optional and no path will save to the current directory then the user can write problem.save() instead of problem.save("")

@StephenNneji
Copy link
Contributor

Also why not save(path = "project.json")? I am not sure there is much benefit to splitting the path and name

@alexhroom
Copy link
Collaborator Author

@StephenNneji the idea was to eliminate some ambiguity: if a user calls project.save(path="~/Documents/my_project"), do they want to save a file called my_project.json in Documents or do they want to save to the directory ~/Documents/my_project/? although looking at some Python standard libraries e.g. pickle or json it seems the idiom is that we assume the path is the path to the file object, and the MATLAB save function also behaves this way, so I guess we can combine them and be opinionated there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants