fix: make filesystem writes and downloads cancellation-safe

This commit is contained in:
objz committed 2026-10-01 23:21:13 +02:00
1 parent 615d3fb8fc
commit 7362354109
18 files changed
+427 -291

No files matched your search

+2 -2
View File
@@ -14,7 +14,7 @@ pub use settings::Config;
#[must_use]
pub fn get_config_path() -> PathBuf {
dirs_next::config_dir()
dirs::config_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("rmcl")
}
@@ -86,7 +86,7 @@ pub(crate) fn upgrade_config_file(path: &std::path::Path) -> io::Result<bool> {
}
pub(crate) fn migrate_legacy_data_paths(path: &std::path::Path) -> io::Result<bool> {
let Some(data_dir) = dirs_next::data_dir() else {
let Some(data_dir) = dirs::data_dir() else {
return Ok(false);
};
migrate_legacy_data_paths_from(path, &data_dir)
+4 -4
View File
@@ -212,7 +212,7 @@ pub struct Paths {
}
fn default_instances_dir() -> String {
dirs_next::data_dir()
dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("rmcl")
.join("instances")
@@ -225,7 +225,7 @@ fn is_default_instances_dir(path: &str) -> bool {
}
fn default_meta_dir() -> String {
dirs_next::data_dir()
dirs::data_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join("rmcl")
.join("meta")
@@ -249,11 +249,11 @@ impl Default for Paths {
pub fn resolve_path(raw: &str) -> PathBuf {
if let Some(stripped) = raw.strip_prefix("~/") {
if let Some(home) = dirs_next::home_dir() {
if let Some(home) = dirs::home_dir() {
return home.join(stripped);
}
} else if raw == "~"
&& let Some(home) = dirs_next::home_dir()
&& let Some(home) = dirs::home_dir()
{
return home;
}