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

Don't change CWD on startup #42

Merged
merged 1 commit into from
Feb 25, 2021
Merged

Don't change CWD on startup #42

merged 1 commit into from
Feb 25, 2021

Conversation

jmrohwer
Copy link
Member

As per #39 changing the current working directory is an unexpected side effect that largely stems from legacy PySCeS code at a time when the HOME environment variable was not properly defined under Windows.

This PR introduces a new configuration option change_dir_on_start = False in pyscfg.ini as well as .pys_usercfg.ini. The default installation option is False but can be set to True in user configuration. When False, the current working directory is maintained upon importing pysces and loading a model. When set to True, the previous behaviour results, i.e. change directory to $HOME/Pysces after importing pysces and loading a model.

Note that the option to set the model directory and output directory to the current working directory still exists in .pys_usercfg.ini, as it has for some time already. This is for keeping PSC files in a folder related to a particular project and not in a central folder, by setting the options as follows:

model_dir = ./
output_dir = ./

Copy link
Member

@bgoli bgoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @jmrohwer 👍

@jmrohwer jmrohwer merged commit 94e4734 into master Feb 25, 2021
@jmrohwer jmrohwer deleted the nocwd branch February 25, 2021 07:27
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 this pull request may close these issues.

2 participants