mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
`dirs-next` is still used by the version of the `term` crate we are using, but this also remoes a version of `cstr` so our dependency count does not change. A new version of `raqote` hasn't been released, so this depends on the upstream repository directly. It's been almost 4 months since the release has been ready -- so it's unclear when it will happen. Fixes #32801. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
43 lines
1.3 KiB
Rust
43 lines
1.3 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
//! Contains routines for retrieving default config directories.
|
|
//! For linux based platforms, it uses the XDG base directory spec but provides
|
|
//! similar abstractions for non-linux platforms.
|
|
|
|
use std::path::PathBuf;
|
|
|
|
#[cfg(all(
|
|
unix,
|
|
not(target_os = "macos"),
|
|
not(target_os = "ios"),
|
|
not(target_os = "android")
|
|
))]
|
|
pub fn default_config_dir() -> Option<PathBuf> {
|
|
let mut config_dir = ::dirs::config_dir().unwrap();
|
|
config_dir.push("servo");
|
|
config_dir.push("default");
|
|
Some(config_dir)
|
|
}
|
|
|
|
#[cfg(target_os = "android")]
|
|
pub fn default_config_dir() -> Option<PathBuf> {
|
|
None
|
|
}
|
|
|
|
#[cfg(target_os = "macos")]
|
|
pub fn default_config_dir() -> Option<PathBuf> {
|
|
// FIXME: use `config_dir()` ($HOME/Library/Preferences)
|
|
// instead of `data_dir()` ($HOME/Library/Application Support) ?
|
|
let mut config_dir = ::dirs::data_dir().unwrap();
|
|
config_dir.push("Servo");
|
|
Some(config_dir)
|
|
}
|
|
|
|
#[cfg(target_os = "windows")]
|
|
pub fn default_config_dir() -> Option<PathBuf> {
|
|
let mut config_dir = ::dirs::config_dir().unwrap();
|
|
config_dir.push("Servo");
|
|
Some(config_dir)
|
|
}
|