anufrievroman / calcure

Modern TUI calendar and task manager with minimal and customizable UI.
https://anufrievroman.gitbook.io/calcure
MIT License
1.51k stars 43 forks source link

Expand tilde in path names #70

Closed jose1711 closed 9 months ago

jose1711 commented 9 months ago

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 commented 9 months ago

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 commented 9 months ago

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

jose1711 commented 9 months ago

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

anufrievroman commented 9 months ago

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 commented 9 months ago

The expansion also works on Windows:

import os
os.path.expanduser(`~')
# 'C:\\Users\\username'
os.path.expanduser(`~otheruser')
# 'C:\\Users\\otheruser'
anufrievroman commented 9 months ago

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