Skip to content

Configurable directory for config, state, and log #203

@sarcasticadmin

Description

@sarcasticadmin

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions