mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-10-22 09:04:34 -04:00
We don't use unwrap in my house.
Co-authored-by: maxichrome <maxichrome@users.noreply.github.com>
This commit is contained in:
1 parent
f29a04c38e
commit
b4e4a4bf57
1 file changed
+2
-2
@@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::{fs, io, io::Write};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Default)]
|
||||
pub struct DotSpaceDrive {
|
||||
pub location_uuid: String,
|
||||
pub library_uuid: String,
|
||||
@@ -24,7 +24,7 @@ static DOTFILE_NAME: &str = ".spacedrive";
|
||||
pub async fn check_location(path: &str) -> Result<DotSpaceDrive, LocationError> {
|
||||
let dotfile: DotSpaceDrive = match fs::File::open(format!("{}/{}", path.clone(), DOTFILE_NAME))
|
||||
{
|
||||
Ok(file) => serde_json::from_reader(file).unwrap(),
|
||||
Ok(file) => serde_json::from_reader(file).unwrap_or(DotSpaceDrive::default()),
|
||||
Err(e) => return Err(LocationError::DotfileReadFailure(e)),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user