Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save database and config files to user .config folder #26

Closed
NotJoeMartinez opened this issue May 29, 2023 · 2 comments
Closed

Save database and config files to user .config folder #26

NotJoeMartinez opened this issue May 29, 2023 · 2 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@NotJoeMartinez
Copy link
Owner

NotJoeMartinez commented May 29, 2023

The script currently saves the database to the current working directory, ideally it should be some where in ~/.local/share/yt-fts/subtitles.db. I don't know the best practices for writing software that "invites itself" to a users config directories.

My general questions are:

  • Do I prompt the user for a config path or just make one without asking?
  • Where do I store these configs on different platforms?
  • Do packages installed through pypi have the system permissions to do this on their own?
  • How ispip uninstall yt-fts supposed to know where this is?
@NotJoeMartinez NotJoeMartinez changed the title Figure out where to save database and config files to Figure out where to save database and config files May 29, 2023
@NotJoeMartinez NotJoeMartinez added help wanted Extra attention is needed question Further information is requested and removed help wanted Extra attention is needed labels May 29, 2023
@NotJoeMartinez NotJoeMartinez changed the title Figure out where to save database and config files Save database and config files to user .config folder May 30, 2023
@chapmanjacobd
Copy link

chapmanjacobd commented May 31, 2023

Do I prompt the user for a config path or just make one without asking?

Generally, CLI tools will either be explicit about input / output files and those will be referenced as arguments, or config will be implicitly created in the background. I think ~/.local/share/yt-fts/ is a sane choice but it would be better to allow it to be overridden:

Path(os.getenv('XDG_DATA_HOME', '~/.local/share'), 'yt-fts').expanduser()
But that path won't work for Windows. Well... I mean it will if you use pathlib and make all the parent folders but it will look weird and users won't expect it. You'll need to do some research here

Where do I store these configs on different platforms?

Do packages installed through pypi have the system permissions to do this on their own?

Yes. Other python programs will try to write to similar folders like that under the user folder.

How ispip uninstall yt-fts supposed to know where this is?

It's probably possible but I don't think pip should know. Generally programs don't delete user files or data files. If they do then people get mad

@NotJoeMartinez
Copy link
Owner Author

Added in #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
Status: Done
Development

No branches or pull requests

2 participants