Skip to content

Commit

Permalink
feat: use fs::exists for AppEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Sep 6, 2024
1 parent f61fa2d commit b1aa7a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Chores
+ Rust 1.81.0 linting, [f61fa2d5791e2bad4752fdcf2be59be218596680]
+ .devcontainer updated, [e28848708c077874f6f9c7b91003eda04760d2c1]
+ dependencies updated, [81b187385240706b6e1fda03ea3d6e307faacebc]

# <a href='https://github.com/mrjackwills/leafcast_pi/releases/tag/v0.2.14'>v0.2.14</a>
### 2024-07-26

Expand Down
7 changes: 4 additions & 3 deletions src/app_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ pub struct AppEnv {

impl AppEnv {
fn check_file_exists(filename: String) -> Result<String, AppError> {
match std::fs::metadata(&filename) {
Ok(_) => Ok(filename),
Err(_) => Err(AppError::FileNotFound(filename)),
if std::fs::exists(&filename)? {
Ok(filename)
} else {
Err(AppError::FileNotFound(filename))
}
}

Expand Down

0 comments on commit b1aa7a7

Please sign in to comment.