Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updefault profile directory #10338
default profile directory #10338
Comments
|
I would like to work on it. |
|
@creativcoder Sure! Let us know if you have any question. |
|
One of my long-standing irritations about Firefox is its lack of XDG Base Directory support. In particular, Firefox uses a single profile folder for all of its files, but the XDG spec has separate paths for configuration/preferences, caches, and data. I find this separation useful because it lets me use a git repo to keep my preferences synced, ignore the cache directory, and use regular backups to keep track of data. I would really appreciate it if we could support this separation in Servo and use separate folders; placing the entire profile folder under Because we're starting fresh here, I'd appreciate getting this right from the start; it's much harder to change the default directory once something has been hardcoded and there is a significant user base already using the old directories. For example, Atom released their 1.0 without addressing this and is now locked into their current defaults. I'm not sure what similar norms exist for Windows and OS X, but we should make sure to follow them. |
|
@aneeshusa Ok. Looks like we have a library already that follows XDG base directory spec https://github.com/whitequark/rust-xdg . We can use that. Will need @paulrouget suggestions on this. |
|
@SimonSapin Wanna chime in? I've seen you commented there: whitequark/rust-xdg#8 |
|
I agree that we should separate non-essential / cache files from configuration / preferences and user data. The conventional way to do that on Linux is per XDG, but I don’t know about other systems. I’d be in favor of putting that separation in place even if we only have preferences so far. Unfortunately that makes a nice single The rust-xdg crate looks good. We may want to make another crate that abstracts different platform’s conventions (using rust-xdg on |
|
Thanks for listening, this is a small thing that makes a big usability difference for me. :) XDG specifies a set of environment variables that allow overriding the folders used for config/cache/data separately; it looks like the rust-xdg crate already uses these. As far as command line options, I think a |
Sounds good to me. |
|
@SimonSapin First we'll add an extra field We can create a mod |
|
Sounds good, except we should have a thing (module, crate, …) to abstract platform differences called something like "basedirs" but not "xdg", since XDG is only relevant and xdg-rs is only used on some platforms. |
|
@SimonSapin @paulrouget Hi have a look at basedirs module; tell me if this looks good, or suggest if this can be done better. https://gist.github.com/creativcoder/7f4a3b57c2c3dc08da47f26a15db7298 |
|
@creativcoder These functions should return |
|
|
Adding default config directories. Fixes #10338 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10498) <!-- Reviewable:end -->
Adding default config directories. Fixes #10338 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10498) <!-- Reviewable:end -->
#10114 introduces a preference file.
The profiler directory is set via the
--profile-diroption.We should have a default directory.
This directory should not be created if it doesn't exist, but just if
--profile-diris not specified anddefault_profile_dir/prefs.jsonexists, then we should read this file.I guess these are good-enough values:
%APPDATA%\servo\~/Library/Application Support/Servo/~/.config/servo/)I would not be surprised if there was already a crate that resolves the default configuration directory for each platform.