Skip to content

Commit

Permalink
Fix another windows compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell committed Mar 26, 2024
1 parent 8e02354 commit b2a6ec3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/system/env/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use std::path::Path;
use tokio::task::spawn_blocking;
use winreg::{enums::HKEY_CURRENT_USER, RegKey};

use crate::{result::RokitResult, storage::Home};
use crate::{
result::{RokitError, RokitResult},
storage::Home,
};

pub async fn add_to_path(home: &Home) -> RokitResult<bool> {
// NOTE: Calls to canonicalize may use blocking filesystem
Expand All @@ -23,13 +26,13 @@ pub async fn add_to_path(home: &Home) -> RokitResult<bool> {
});

if path_already_exists {
Ok(false)
Ok::<_, RokitError>(false)
} else {
let new_path = format!("{path};{}", dir.display());
env.set_value("PATH", &new_path)?;
Ok(true)
Ok::<_, RokitError>(true)
}
});

Ok(task.await??)
task.await?
}

0 comments on commit b2a6ec3

Please sign in to comment.