From b1aa7a7a0a0446d1461b9f10e79cf54885649a89 Mon Sep 17 00:00:00 2001
From: Jack Wills <32690432+mrjackwills@users.noreply.github.com>
Date: Fri, 6 Sep 2024 16:41:21 +0000
Subject: [PATCH] feat: use fs::exists for AppEnv
---
CHANGELOG.md | 5 +++++
src/app_env.rs | 7 ++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eeadef1..4760568 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+### Chores
++ Rust 1.81.0 linting, [f61fa2d5791e2bad4752fdcf2be59be218596680]
++ .devcontainer updated, [e28848708c077874f6f9c7b91003eda04760d2c1]
++ dependencies updated, [81b187385240706b6e1fda03ea3d6e307faacebc]
+
# v0.2.14
### 2024-07-26
diff --git a/src/app_env.rs b/src/app_env.rs
index 2197e9d..49d3a23 100644
--- a/src/app_env.rs
+++ b/src/app_env.rs
@@ -69,9 +69,10 @@ pub struct AppEnv {
impl AppEnv {
fn check_file_exists(filename: String) -> Result {
- 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))
}
}