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

Disk location #46

Closed
hinto-janai opened this issue Dec 13, 2023 · 7 comments
Closed

Disk location #46

hinto-janai opened this issue Dec 13, 2023 · 7 comments
Labels
C-discussion General discussion or questions.

Comments

@hinto-janai
Copy link
Contributor

What

Where will Cuprate store files on disk?

Closes monero-project/monero#8202 in spirit ❤️

Most likely

OS standards are settled and are available in the widely used https://docs.rs/dirs.

Reference:

Examples:

OS PATH
Windows C:\Users\Alice\AppData\Roaming\Cuprate\cuprate.toml
macOS /Users/Alice/Library/Application Support/Cuprate/cuprate.toml
Linux /home/alice/.config/cuprate/cuprate.toml

What else

There are some remaining questions:

  • on macOS, the XDG standard could also be considered, leading to ~/.config/cuprate/cuprate.toml there as well
  • should the heavy separation of files (~/.config, ~/.cache, ~/.local/share) be skipped?
  • should global files be supported (/etc/cuprate.toml)?

Supporting user override PATHs will also need to be supported, for all file types (config, cache, database, etc).

@rbrunner7
Copy link

Hopefully Rust left behind stupid bugs in its file and path name handling for good! The standard C++ library that Monero uses on Windows does not support Unicode in the stream classes. Names with Unicode characters mostly occur of course if the user's name has some "special" character in it.

@hinto-janai
Copy link
Contributor Author

Rust's std::path abstracts over ASCII, UTF-8, and UTF-16 :)

@SyntheticBird45
Copy link
Member

SyntheticBird45 commented Dec 18, 2023

should global files be supported (/etc/cuprate.toml)?

Yes, a flexible systemd/initd script would otherwise be difficult to setup. Monerod systemd service use by default the --config /etc/monerod.conf and I think it is great

should the heavy separation of files (~/.config, ~/.cache, ~/.local/share) be skipped?

From a user experience, I hate searching through different folders. Cuprate can split files but then it should be clearly explained in the wiki or other accessible documentation.

on macOS, the XDG standard could also be considered, leading to ~/.config/cuprate/cuprate.toml there as well

This one is up to anyone natural language interpretation. Is cuprate.toml more of a config file or an application support file. It is more a settings file than anything else. I think ~/.config/cuprate/cuprate.toml is better

@hinto-janai
Copy link
Contributor Author

Cuprate can split files but then it should be clearly explained in the wiki or other accessible documentation

I think:

  • The main cuprate.toml -> ~/.config
  • All non-essential cache files -> ~/.cache
  • Everything else -> ~/.local/share

This one is up to anyone natural language interpretation

I meant that macOS has 2 locations for files. Looking at this again, I think we should just stick to Apple's standard, using ~/Library/Application Support; this is used by most applications and is actually what dirs::config_dir() returns.

@SyntheticBird45
Copy link
Member

I meant that macOS has 2 locations for files. Looking at this again, I think we should just stick to Apple's standard, using ~/Library/Application Support; this is used by most applications and is actually what dirs::config_dir() returns.

Makes sense indeed. Let's go for Application Support then

I think:

I'm not sure if the ~/.local/share ~/.cache and ~/.config is a linux consensus or an XDG standard ?
I could imagine people would make cuprate runs on a server with just a chowned folder with the cuprate user. Not sure there will be these folders by default (at least using adduser). The paths look good for me but then we'll have to set fallback if these folders don't exist

@hinto-janai
Copy link
Contributor Author

XDG is the defacto Linux standard.

Every program I've ever used calls std::fs::create_dir_all() or equivalent on missing folders.

@hinto-janai
Copy link
Contributor Author

Implemented in #67 with the standards in the original post.

@hinto-janai hinto-janai added the C-discussion General discussion or questions. label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion General discussion or questions.
Projects
None yet
Development

No branches or pull requests

3 participants