mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-05 05:46:24 -04:00
move from try to try_exists for explicit error handling
This commit is contained in:
@@ -126,7 +126,7 @@ pub(crate) fn mount() -> rspc::RouterBuilder<
|
||||
.join(&object.cas_id)
|
||||
.with_extension("webp");
|
||||
|
||||
object.has_thumbnail = thumb_path.exists();
|
||||
object.has_thumbnail = thumb_path.try_exists().unwrap();
|
||||
}
|
||||
ExplorerItem::Path(Box::new(file_path))
|
||||
})
|
||||
|
||||
@@ -61,7 +61,7 @@ pub(crate) fn mount() -> RouterBuilder {
|
||||
.join(&object.cas_id)
|
||||
.with_extension("webp");
|
||||
|
||||
object.has_thumbnail = thumb_path.exists();
|
||||
object.has_thumbnail = thumb_path.try_exists().unwrap();
|
||||
|
||||
ExplorerItem::Object(Box::new(object))
|
||||
})
|
||||
|
||||
@@ -93,7 +93,7 @@ impl LibraryManager {
|
||||
};
|
||||
|
||||
let db_path = config_path.clone().with_extension("db");
|
||||
if !db_path.exists() {
|
||||
if !db_path.try_exists().unwrap() {
|
||||
println!(
|
||||
"Found library '{}' but no matching database file was found. Skipping...",
|
||||
config_path.display()
|
||||
|
||||
@@ -44,7 +44,7 @@ impl LocationCreateArgs {
|
||||
ctx: &LibraryContext,
|
||||
) -> Result<indexer_job_location::Data, LocationError> {
|
||||
// check if we have access to this location
|
||||
if !self.path.exists() {
|
||||
if !self.path.try_exists().unwrap() {
|
||||
return Err(LocationError::PathNotFound(self.path));
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ impl NodeConfigManager {
|
||||
async fn read(base_path: &PathBuf) -> Result<NodeConfig, NodeConfigError> {
|
||||
let path = Path::new(base_path).join(NODE_STATE_CONFIG_NAME);
|
||||
|
||||
match path.exists() {
|
||||
match path.try_exists().unwrap() {
|
||||
true => {
|
||||
let mut file = File::open(&path)?;
|
||||
let base_config: ConfigMetadata =
|
||||
|
||||
@@ -189,7 +189,7 @@ impl StatefulJob for ThumbnailJob {
|
||||
let output_path = data.thumbnail_dir.join(&cas_id).with_extension("webp");
|
||||
|
||||
// check if file exists at output path
|
||||
if !output_path.exists() {
|
||||
if !output_path.try_exists().unwrap() {
|
||||
info!("Writing {:?} to {:?}", path, output_path);
|
||||
|
||||
match step.kind {
|
||||
|
||||
@@ -7,7 +7,7 @@ fn main() {
|
||||
println!("Issuing sdtunnel certificate...");
|
||||
|
||||
let env_file = Path::new("./.env");
|
||||
if env_file.exists() {
|
||||
if env_file.try_exists().unwrap() {
|
||||
println!("File '{}' already exists. Exiting...", env_file.display());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user