Skip to content

Commit

Permalink
Fix accidental exists(), should be is_file(), also error!() is okay h…
Browse files Browse the repository at this point in the history
…ere since it's confirmed these are files, it should never error out
  • Loading branch information
MolotovCherry committed May 19, 2024
1 parent 23bee7a commit b7cc838
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/yet-another-bg3-mod-loader/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fs, path::Path};

use directories::BaseDirs;
use eyre::{bail, eyre, Result};
use tracing::{debug, info, trace};
use tracing::{error, info, trace};

use crate::{config::Config, popup::fatal_popup};

Expand Down Expand Up @@ -78,19 +78,19 @@ pub fn build_config_game_binary_paths(config: &Config) -> Bg3Exes {
let bg3 = path.join("bg3.exe");
let bg3_dx11 = path.join("bg3_dx11.exe");

if bg3.is_file() && bg3_dx11.exists() {
if bg3.is_file() && bg3_dx11.is_file() {
let bg3 = match fs::canonicalize(&bg3) {
Ok(p) => p,
Err(e) => {
debug!(error = %e, path = %bg3.display(), "failed to canonicalize");
error!(error = %e, path = %bg3.display(), "failed to canonicalize");
continue;
}
};

let bg3_dx11 = match fs::canonicalize(&bg3_dx11) {
Ok(p) => p,
Err(e) => {
debug!(error = %e, path = %bg3_dx11.display(), "failed to canonicalize");
error!(error = %e, path = %bg3_dx11.display(), "failed to canonicalize");
continue;
}
};
Expand Down

0 comments on commit b7cc838

Please sign in to comment.