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

Expand tilde in path names #70

Closed
jose1711 opened this issue Nov 19, 2023 · 6 comments
Closed

Expand tilde in path names #70

jose1711 opened this issue Nov 19, 2023 · 6 comments
Labels
Feature request New feature or request

Comments

@jose1711
Copy link
Contributor

It is a common practice to expand tilde in paths. Calcure does not do that and a user need to specify full path to a file/directory each time.

# this works
ics_event_files = /home/user/.calendars/gmail.ics

# this does not
ics_event_files = ~/.calendars/gmail.ics
@anufrievroman
Copy link
Owner

anufrievroman commented Nov 20, 2023

In general, I'd say I should improve working with paths by using path library more actively instead of just string everywhere. I think path lib is able to understand path in different OS with different conventions.

@anufrievroman anufrievroman added the Feature request New feature or request label Nov 20, 2023
anufrievroman added a commit that referenced this issue Nov 20, 2023
@anufrievroman
Copy link
Owner

I think I fixed it in e88d9a5 but it requires some testing, please check if it works for you.

@jose1711
Copy link
Contributor Author

Thank you, that fixes it but I think the initial config.ini should now also contain ~ instead of /home/user.

@anufrievroman
Copy link
Owner

By default, I'd prefer a full system path because the ~ expansion only works in unix via $HOME variable. Not sure what would happen in Windows and what's considered home there.

@jose1711
Copy link
Contributor Author

The expansion also works on Windows:

import os
os.path.expanduser(`~')
# 'C:\\Users\\username'
os.path.expanduser(`~otheruser')
# 'C:\\Users\\otheruser'

anufrievroman added a commit that referenced this issue Nov 22, 2023
@anufrievroman
Copy link
Owner

Okay, with 78913c4 it is shortened by default. Although I didn't test on Windows yet.

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

No branches or pull requests

2 participants