Skip to content

Commit

Permalink
allow user to override calcurse load dir location
Browse files Browse the repository at this point in the history
  • Loading branch information
purarue committed Oct 19, 2023
1 parent 293b7bd commit 5d3b694
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export CALCURSE_DIR="$HOME/Documents/calcurse"
alias calcurse='calcurse --datadir "$CALCURSE_DIR" --confdir ~/.config/calcurse "$@"'
```

In addition to that, this maintains a data directory in `$XDG_DATA_HOME/calcurse_load`, where it stores data for `gcal_index`.
In addition to that, this maintains a data directory in `$XDG_DATA_HOME/calcurse_load` (you can overwrite this with `$CALCURSE_LOAD_DIR`), where it stores data for `gcal_index`.

## About

Expand Down
4 changes: 3 additions & 1 deletion calcurse_load/calcurse.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ def get_configuration() -> Configuration:
if "CALCURSE_DIR" in os.environ:
calcurse_dir = Path(os.environ["CALCURSE_DIR"])
calcurse_load_dir: Path = xdg_data / "calcurse_load"
if "CALCURSE_LOAD_DIR" in os.environ:
calcurse_load_dir = Path(os.environ["CALCURSE_LOAD_DIR"])
if not calcurse_dir.exists():
warnings.warn(
"Calcurse data directory at {} doesn't exist.".format(str(calcurse_dir))
)
if not calcurse_load_dir.exists():
os.makedirs(str(calcurse_load_dir))
calcurse_load_dir.mkdir(parents=True)
return Configuration(
calcurse_dir=calcurse_dir,
calcurse_load_dir=calcurse_load_dir,
Expand Down

0 comments on commit 5d3b694

Please sign in to comment.