From 5626195e7e8eac5b9b1f2d5d9e87f3ed5052bf96 Mon Sep 17 00:00:00 2001 From: Jesse Hitch Date: Sun, 21 May 2023 15:20:47 +0200 Subject: [PATCH] add additional directories for creating python stuff --- .config/python/interactive_startup.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.config/python/interactive_startup.py b/.config/python/interactive_startup.py index 92a6dfd..8aa649e 100644 --- a/.config/python/interactive_startup.py +++ b/.config/python/interactive_startup.py @@ -4,13 +4,22 @@ import atexit import os from pathlib import Path import readline -from xdg_base_dirs import xdg_state_home +from xdg_base_dirs import xdg_state_home, xdg_cache_home, xdg_data_home -# define and create the state dir for python if it doesn't exist -# state_dir = os.path.join(xdg_state_home(), 'python') +# create the XDG_STATE_HOME/python dir if it doesn't exist +# most likely going to be $HOME/.local/state/python state_dir = Path.joinpath(xdg_state_home(), 'python') Path(state_dir).mkdir(exist_ok=True) +# create the XDG_CACHE_HOME/python dir if it doesn't exist +# most likely going to be $HOME/.cache/python +cache_dir = Path.joinpath(xdg_cache_home(), 'python') +Path(cache_dir).mkdir(exist_ok=True) + +# create the XDG_DATA_HOME/python dir if it doesn't exist +# most likely going to be $HOME/.local/share/python +data_dir = Path.joinpath(xdg_data_home(), 'python') +Path(data_dir).mkdir(exist_ok=True) # define history file name history = os.path.join(state_dir, 'history')