mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Restore Android to using /sdcard/servo for data, cache, and config paths
This commit is contained in:
parent
988cdf98eb
commit
a8ca2c86f0
2 changed files with 20 additions and 5 deletions
|
@ -9,30 +9,45 @@
|
|||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))]
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
|
||||
use xdg;
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))]
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
|
||||
pub fn default_config_dir() -> Option<PathBuf> {
|
||||
let xdg_dirs = xdg::BaseDirectories::with_profile("servo", "default").unwrap();
|
||||
let config_dir = xdg_dirs.get_config_home();
|
||||
Some(config_dir)
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))]
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn default_config_dir() -> Option<PathBuf> {
|
||||
Some(PathBuf::from("/sdcard/servo"))
|
||||
}
|
||||
|
||||
#[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(all(unix, not(target_os = "macos"), not(target_os = "ios")))]
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn default_data_dir() -> Option<PathBuf> {
|
||||
Some(PathBuf::from("/sdcard/servo"))
|
||||
}
|
||||
|
||||
#[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")]
|
||||
pub fn default_cache_dir() -> Option<PathBuf> {
|
||||
Some(PathBuf::from("/sdcard/servo"))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn default_config_dir() -> Option<PathBuf> {
|
||||
let mut config_dir = env::home_dir().unwrap();
|
||||
|
|
|
@ -37,7 +37,7 @@ extern crate rustc_serialize;
|
|||
extern crate serde;
|
||||
extern crate smallvec;
|
||||
extern crate url;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios")))]
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
|
||||
extern crate xdg;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue