Description
Currently contact writes out its config, state, and log to the scripts' parent directory:
|
json_file_path = os.path.join(parent_dir, "config.json") |
|
log_file_path = os.path.join(parent_dir, "client.log") |
|
db_file_path = os.path.join(parent_dir, "client.db") |
If contactdoes not having access to write to the parent directory, it cannot run. And there is no current way for this path to be set by the user:
$ /nix/store/sj46lpiaqb4v9ysvvcidkfkai0bqk4pm-contact-1.3.14/bin/contact -h
Traceback (most recent call last):
File "/nix/store/sj46lpiaqb4v9ysvvcidkfkai0bqk4pm-contact-1.3.14/bin/.contact-wrapped", line 6, in <module>
from contact.__main__ import start
File "/nix/store/sj46lpiaqb4v9ysvvcidkfkai0bqk4pm-contact-1.3.14/lib/python3.13/site-packages/contact/__main__.py", line 27, in <module>
import contact.ui.default_config as config
File "/nix/store/sj46lpiaqb4v9ysvvcidkfkai0bqk4pm-contact-1.3.14/lib/python3.13/site-packages/contact/ui/default_config.py", line 203, in <module>
loaded_config = initialize_config()
File "/nix/store/sj46lpiaqb4v9ysvvcidkfkai0bqk4pm-contact-1.3.14/lib/python3.13/site-packages/contact/ui/default_config.py", line 150, in initialize_config
with open(json_file_path, "w", encoding="utf-8") as json_file:
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/nix/store/sj46lpiaqb4v9ysvvcidkfkai0bqk4pm-contact-1.3.14/lib/python3.13/site-packages/contact/config.json'
Anything under /nix/store is readonly
Ideas
Ideas to help resolve this:
- Consider making this parent directory configurable. This would need to change how initialization happens for the config since right now it happens on import:
|
loaded_config = initialize_config() |
|
assign_config_variables(loaded_config) |
- Defaulting to a parent directory in $HOME or utilizing the XDG directory specs might be more appropriate: https://specifications.freedesktop.org/basedir-spec/latest/
Description
Currently
contactwrites out its config, state, and log to the scripts' parent directory:contact/contact/ui/default_config.py
Lines 11 to 13 in 6ed0cc8
If
contactdoes not having access to write to the parent directory, it cannot run. And there is no current way for this path to be set by the user:Ideas
Ideas to help resolve this:
contact/contact/ui/default_config.py
Lines 203 to 204 in 6ed0cc8