fix(desktop): disk space detection on overlay fs (#5226)
This commit is contained in:
parent
eecaa745af
commit
39124fb50d
9 changed files with 36 additions and 30 deletions
|
|
@ -39,7 +39,7 @@
|
|||
"@hoppscotch/httpsnippet": "3.0.9",
|
||||
"@hoppscotch/js-sandbox": "workspace:^",
|
||||
"@hoppscotch/kernel": "workspace:^",
|
||||
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce",
|
||||
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31",
|
||||
"@hoppscotch/ui": "0.2.5",
|
||||
"@hoppscotch/vue-toasted": "0.1.0",
|
||||
"@lezer/highlight": "1.2.0",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"@fontsource-variable/material-symbols-rounded": "5.1.3",
|
||||
"@fontsource-variable/roboto-mono": "5.1.0",
|
||||
"@hoppscotch/kernel": "workspace:^",
|
||||
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce",
|
||||
"@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31",
|
||||
"@hoppscotch/ui": "0.2.1",
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-process": "2.2.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 - CuriousCorrelation
|
||||
Copyright (c) 2025 - CuriousCorrelation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
|
|
@ -100,6 +100,6 @@ Requirements:
|
|||
|
||||
## License
|
||||
|
||||
Code: (c) 2024 - CuriousCorrelation
|
||||
Code: (c) 2025 - CuriousCorrelation
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 CuriousCorrelation
|
||||
// Copyright 2025 CuriousCorrelation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
|
|
|
|||
|
|
@ -153,26 +153,32 @@ impl StorageManager {
|
|||
StorageError::Io(e)
|
||||
})?;
|
||||
|
||||
// Convert both paths to the same format for comparison, Windows...
|
||||
let normalized_storage = dunce::canonicalize(&storage_path).unwrap_or(storage_path.clone());
|
||||
|
||||
// NOTE: There cannot be more than one user config storage disk,
|
||||
// although even if there is, defaulting to the first one we found
|
||||
// is as good of a guess as any.
|
||||
let disk = disks.into_iter().find(|disk| {
|
||||
// Convert both paths to the same format for comparison, Windows...
|
||||
let normalized_storage =
|
||||
dunce::canonicalize(&storage_path).unwrap_or(storage_path.clone());
|
||||
let normalized_disk = dunce::canonicalize(disk.mount_point())
|
||||
.unwrap_or_else(|_| disk.mount_point().to_path_buf());
|
||||
// Find the disk with the longest matching mount point
|
||||
let disk = disks
|
||||
.into_iter()
|
||||
.filter_map(|disk| {
|
||||
let normalized_disk = dunce::canonicalize(disk.mount_point())
|
||||
.unwrap_or_else(|_| disk.mount_point().to_path_buf());
|
||||
|
||||
normalized_storage.starts_with(&normalized_disk)
|
||||
});
|
||||
|
||||
let Some(disk) = disk else {
|
||||
tracing::error!(
|
||||
storage_path = %storage_path.display(),
|
||||
"Fatal error, unable to resolve user config storage disk"
|
||||
);
|
||||
return Err(StorageError::DiskNotFound);
|
||||
};
|
||||
normalized_storage
|
||||
.starts_with(&normalized_disk)
|
||||
.then_some((disk, normalized_disk))
|
||||
})
|
||||
.max_by_key(|(_, normalized_disk)| normalized_disk.as_os_str().len())
|
||||
.map(|(disk, _)| disk)
|
||||
.ok_or_else(|| {
|
||||
tracing::error!(
|
||||
storage_path = %storage_path.display(),
|
||||
"Fatal error, unable to resolve user config storage disk"
|
||||
);
|
||||
StorageError::DiskNotFound
|
||||
})?;
|
||||
|
||||
let available = disk.available_space();
|
||||
|
||||
|
|
|
|||
2
packages/hoppscotch-desktop/src-tauri/Cargo.lock
generated
2
packages/hoppscotch-desktop/src-tauri/Cargo.lock
generated
|
|
@ -5038,7 +5038,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "tauri-plugin-appload"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=0308b55e82f7f01d878a7fdf0f597d1dc975f2ce#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce"
|
||||
source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=1b52e49d881926135838cf6cfebdc1643a9bec31#1b52e49d881926135838cf6cfebdc1643a9bec31"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ tauri-plugin-store = "2.2.0"
|
|||
tauri-plugin-dialog = "2.2.0"
|
||||
tauri-plugin-fs = "2.2.0"
|
||||
tauri-plugin-deep-link = "2.2.0"
|
||||
tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "0308b55e82f7f01d878a7fdf0f597d1dc975f2ce" }
|
||||
tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "1b52e49d881926135838cf6cfebdc1643a9bec31" }
|
||||
tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "0147ac1bb29d3b88d6652432a482bd86f0174506" }
|
||||
axum = "0.8.1"
|
||||
tower-http = { version = "0.6.2", features = ["cors"] }
|
||||
|
|
|
|||
|
|
@ -525,8 +525,8 @@ importers:
|
|||
specifier: workspace:^
|
||||
version: link:../hoppscotch-kernel
|
||||
'@hoppscotch/plugin-appload':
|
||||
specifier: github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce
|
||||
version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce'
|
||||
specifier: github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31
|
||||
version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31'
|
||||
'@hoppscotch/ui':
|
||||
specifier: 0.2.5
|
||||
version: 0.2.5(eslint@8.57.0)(terser@5.39.2)(typescript@5.8.3)(vite@5.4.9(@types/node@22.15.19)(sass@1.79.5)(terser@5.39.2))(vue@3.5.12(typescript@5.8.3))
|
||||
|
|
@ -998,8 +998,8 @@ importers:
|
|||
specifier: workspace:^
|
||||
version: link:../hoppscotch-kernel
|
||||
'@hoppscotch/plugin-appload':
|
||||
specifier: github:CuriousCorrelation/tauri-plugin-appload#0308b55e82f7f01d878a7fdf0f597d1dc975f2ce
|
||||
version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce'
|
||||
specifier: github:CuriousCorrelation/tauri-plugin-appload#1b52e49d881926135838cf6cfebdc1643a9bec31
|
||||
version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31'
|
||||
'@hoppscotch/ui':
|
||||
specifier: 0.2.1
|
||||
version: 0.2.1(eslint@9.27.0(jiti@2.4.2))(terser@5.39.2)(typescript@5.8.3)(vite@5.4.11(@types/node@22.15.19)(sass@1.80.3)(terser@5.39.2))(vue@3.5.12(typescript@5.8.3))
|
||||
|
|
@ -1838,8 +1838,8 @@ packages:
|
|||
graphql:
|
||||
optional: true
|
||||
|
||||
'@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce':
|
||||
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce}
|
||||
'@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31':
|
||||
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31}
|
||||
version: 0.1.0
|
||||
|
||||
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/0147ac1bb29d3b88d6652432a482bd86f0174506':
|
||||
|
|
@ -14528,7 +14528,7 @@ snapshots:
|
|||
optionalDependencies:
|
||||
graphql: 16.11.0
|
||||
|
||||
'@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/0308b55e82f7f01d878a7fdf0f597d1dc975f2ce':
|
||||
'@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/1b52e49d881926135838cf6cfebdc1643a9bec31':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.1.1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue