Skip to content
This repository has been archived by the owner on Apr 5, 2021. It is now read-only.

get_app_dir creates directories despite the documentation saying otherwise #34

Open
ghost opened this issue Dec 16, 2018 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Dec 16, 2018

The documentation for get_app_dir claims that it "[r]eturns (but does not create)" the path. However, its implementation calls get_root which does in fact create the path anyway. The other getters have similar problematic code.

This will create unexpected stray directories and/or fail when $HOME is not actually set to the user's home directory, such as when the environment has been cleared with env -i.

robinkrahl added a commit to robinkrahl/app_dirs2 that referenced this issue Aug 2, 2020
According to the documentation, the get_* functions should not touch the
file system while the functions without the get_ prefix create the
returned directory (and all parent directories).

But with the current implementation, the get_* functions do create
the data and app root directories if they don’t exist, see bug report
34 in the original repository:
	andybarron/app-dirs-rs#34

This patch adds a test suite that demonstrates the problem.
robinkrahl added a commit to robinkrahl/app_dirs2 that referenced this issue Aug 2, 2020
According to their documentation, the get_app_root and get_app_dir
functions only return the requested directories and do not create them.
But the functions called the data_root and app_root functions that
create missing directories.  See this bug report in the original
project:
	andybarron/app-dirs-rs#34

This patch fixes this problem by calling get_data_root and get_app_root
instead.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants