Replace dirs and directories with maintained (#2949)

This commit is contained in:
Caden Haustein 2021-01-19 20:24:27 +00:00 committed by GitHub
parent 2e6d836dd1
commit 430da53f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 389 additions and 302 deletions

612
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -42,8 +42,8 @@ codespan-reporting = "0.11.0"
csv = "1.1.3"
ctrlc = { version = "3.1.6", optional = true }
derive-new = "0.5.8"
directories = { version = "3.0.1", optional = true }
dirs = { version = "3.0.1", optional = true }
directories-next = { version = "2.0.0", optional = true }
dirs-next = { version = "2.0.0", optional = true }
dtparse = "1.2.0"
dunce = "1.0.1"
eml-parser = "0.1.0"
@ -134,3 +134,5 @@ rich-benchmark = ["heim"]
rustyline-support = ["rustyline", "nu-engine/rustyline-support"]
stable = []
trash-support = ["trash"]
dirs = ["dirs-next"]
directories = ["directories-next"]

View File

@ -29,7 +29,7 @@ impl PathCompleter {
{
let home_prefix = format!("~{}", SEP);
if base_dir_name.starts_with(&home_prefix) {
let mut home_dir = dirs::home_dir().unwrap_or_else(|| PathBuf::from("~"));
let mut home_dir = dirs_next::home_dir().unwrap_or_else(|| PathBuf::from("~"));
home_dir.push(&base_dir_name[2..]);
home_dir
} else {

View File

@ -41,8 +41,8 @@ codespan-reporting = "0.11.0"
csv = "1.1.3"
ctrlc = { version = "3.1.6", optional = true }
derive-new = "0.5.8"
directories = { version = "3.0.1", optional = true }
dirs = { version = "3.0.1", optional = true }
directories-next = { version = "2.0.0", optional = true }
dirs-next = { version = "2.0.0", optional = true }
dtparse = "1.2.0"
dunce = "1.0.1"
eml-parser = "0.1.0"
@ -131,3 +131,5 @@ rich-benchmark = ["heim"]
rustyline-support = ["rustyline"]
stable = []
trash-support = ["trash"]
directories = ["directories-next"]
dirs = ["dirs-next"]

View File

@ -96,7 +96,7 @@ async fn run_with_stdin(
#[cfg(feature = "dirs")]
{
home_dir = dirs::home_dir;
home_dir = dirs_next::home_dir;
}
#[cfg(not(feature = "dirs"))]
{

View File

@ -139,7 +139,7 @@ fn filesystem_change_to_home_directory() {
"#
);
assert_eq!(Some(PathBuf::from(actual.out)), dirs::home_dir());
assert_eq!(Some(PathBuf::from(actual.out)), dirs_next::home_dir());
})
}

View File

@ -16,8 +16,8 @@ byte-unit = "4.0.9"
chrono = "0.4.15"
derive-new = "0.5.8"
directories = {version = "3.0.1", optional = true}
dirs = {version = "3.0.1", optional = true}
directories-next = { version = "2.0.0", optional = true }
dirs-next = { version = "2.0.0", optional = true }
getset = "0.1.1"
indexmap = { version = "1.6.0", features = ["serde-1"] }
log = "0.4.11"
@ -38,3 +38,7 @@ nu-value-ext = {version = "0.25.2", path = "../nu-value-ext"}
[target.'cfg(unix)'.dependencies]
users = "0.10.0"
[features]
directories = ["directories-next"]
dirs = ["dirs-next"]

View File

@ -145,7 +145,7 @@ pub fn value_to_toml_value(v: &Value) -> Result<toml::Value, ShellError> {
#[cfg(feature = "directories")]
pub fn config_path() -> Result<PathBuf, ShellError> {
use directories::ProjectDirs;
use directories_next::ProjectDirs;
let dir = ProjectDirs::from("org", "nushell", "nu")
.ok_or_else(|| ShellError::untagged_runtime_error("Couldn't find project directory"))?;
@ -181,7 +181,7 @@ pub fn default_path_for(file: &Option<PathBuf>) -> Result<PathBuf, ShellError> {
#[cfg(feature = "directories")]
pub fn user_data() -> Result<PathBuf, ShellError> {
use directories::ProjectDirs;
use directories_next::ProjectDirs;
let dir = ProjectDirs::from("org", "nushell", "nu")
.ok_or_else(|| ShellError::untagged_runtime_error("Couldn't find project directory"))?;

View File

@ -21,7 +21,7 @@ async-recursion = "0.3.1"
async-trait = "0.1.40"
bytes = "0.5.6"
derive-new = "0.5.8"
dirs = {version = "3.0.1", optional = true}
dirs-next = { version = "2.0.0", optional = true }
dunce = "1.0.1"
encoding_rs = "0.8.24"
filesize = "0.2.0"
@ -51,3 +51,4 @@ nu-test-support = {version = "0.25.2", path = "../nu-test-support"}
[features]
rustyline-support = []
dirs = ["dirs-next"]

View File

@ -72,7 +72,7 @@ impl FilesystemShell {
pub fn homedir_if_possible() -> Option<PathBuf> {
#[cfg(feature = "dirs")]
{
dirs::home_dir()
dirs_next::home_dir()
}
#[cfg(not(feature = "dirs"))]

View File

@ -144,7 +144,7 @@ impl Shell for HelpShell {
fn homedir(&self) -> Option<PathBuf> {
#[cfg(feature = "dirs")]
{
dirs::home_dir()
dirs_next::home_dir()
}
#[cfg(not(feature = "dirs"))]