mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
fix(deps): update rust crate xdg to v3 (#1950)
* fix(deps): update rust crate xdg to v3 * fix: xdg BaseDirectories has default values --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: zonyitoo <zonyitoo@gmail.com>
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -4858,9 +4858,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "xdg"
|
||||
version = "2.5.2"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
|
||||
checksum = "2fb433233f2df9344722454bc7e96465c9d03bff9d77c248f9e7523fe79585b5"
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
|
||||
@@ -226,7 +226,7 @@ qrcode = { version = "0.14", default-features = false, optional = true }
|
||||
sysexits = "0.9"
|
||||
build-time = "0.1"
|
||||
directories = "6.0"
|
||||
xdg = "2.5"
|
||||
xdg = "3.0"
|
||||
rpassword = "7.3"
|
||||
libc = { version = "0.2", features = ["extra_traits"] }
|
||||
rand = "0.9"
|
||||
|
||||
@@ -54,7 +54,8 @@ pub fn get_default_config_path(config_file: &str) -> Option<PathBuf> {
|
||||
// UNIX systems, XDG Base Directory
|
||||
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
#[cfg(unix)]
|
||||
if let Ok(base_directories) = xdg::BaseDirectories::with_prefix("shadowsocks-rust") {
|
||||
{
|
||||
let base_directories = xdg::BaseDirectories::with_prefix("shadowsocks-rust");
|
||||
// $XDG_CONFIG_HOME/shadowsocks-rust/config.json
|
||||
// for dir in $XDG_CONFIG_DIRS; $dir/shadowsocks-rust/config.json
|
||||
for filename in &config_files {
|
||||
@@ -67,12 +68,13 @@ pub fn get_default_config_path(config_file: &str) -> Option<PathBuf> {
|
||||
// UNIX global configuration file
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let mut global_config_path = PathBuf::from("/etc/shadowsocks-rust");
|
||||
for filename in &config_files {
|
||||
let path_str = "/etc/shadowsocks-rust/".to_owned() + filename;
|
||||
let global_config_path = Path::new(&path_str);
|
||||
global_config_path.push(filename);
|
||||
if global_config_path.exists() {
|
||||
return Some(global_config_path.to_path_buf());
|
||||
}
|
||||
global_config_path.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user