Skip to content

adds user_download_dir() function to get download directory#147

Open
eukreign wants to merge 5 commits intoActiveState:masterfrom
eukreign:master
Open

adds user_download_dir() function to get download directory#147
eukreign wants to merge 5 commits intoActiveState:masterfrom
eukreign:master

Conversation

@eukreign
Copy link

No description provided.

config_dirs = os.path.join(user_config_dir(), 'user-dirs.dirs')
with open(config_dirs) as dirs_file:
path_match = re.search(r'XDG_DOWNLOAD_DIR=(.+)', dirs_file.read())
cleaned_path = path_match.group(1).replace('"', '').replace('$HOME', '~')
Copy link

Choose a reason for hiding this comment

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

If I follow correctly this will be more generic if you use os.path.expandvars.

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