mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
removed default_data_dir() and default_cache_dir() components/config/basedir.rs
This commit is contained in:
parent
48ff3965cc
commit
e1f72f845e
1 changed files with 0 additions and 34 deletions
|
@ -31,40 +31,6 @@ pub fn default_config_dir() -> PathBuf {
|
||||||
PathBuf::from(dir.to_str().unwrap())
|
PathBuf::from(dir.to_str().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
|
|
||||||
pub fn default_data_dir() -> Option<PathBuf> {
|
|
||||||
let xdg_dirs = xdg::BaseDirectories::with_profile("servo", "default").unwrap();
|
|
||||||
let data_dir = xdg_dirs.get_data_home();
|
|
||||||
Some(data_dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
pub fn default_data_dir() -> Option<PathBuf> {
|
|
||||||
let dir = unsafe {
|
|
||||||
CStr::from_ptr((*android_injected_glue::get_app().activity).internalDataPath)
|
|
||||||
};
|
|
||||||
Some(PathBuf::from(dir.to_str().unwrap()))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
|
|
||||||
pub fn default_cache_dir() -> Option<PathBuf> {
|
|
||||||
let xdg_dirs = xdg::BaseDirectories::with_profile("servo", "default").unwrap();
|
|
||||||
let cache_dir = xdg_dirs.get_cache_home();
|
|
||||||
Some(cache_dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
pub fn default_cache_dir() -> Option<PathBuf> {
|
|
||||||
// TODO: Use JNI to call context.getCacheDir().
|
|
||||||
// There is no equivalent function in NDK/NativeActivity.
|
|
||||||
let dir = unsafe {
|
|
||||||
CStr::from_ptr((*android_injected_glue::get_app().activity).externalDataPath)
|
|
||||||
};
|
|
||||||
Some(PathBuf::from(dir.to_str().unwrap()))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub fn default_config_dir() -> PathBuf {
|
pub fn default_config_dir() -> PathBuf {
|
||||||
let mut config_dir = env::home_dir().unwrap();
|
let mut config_dir = env::home_dir().unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue