-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Now catch std::filesystem exceptions in parameters (#1127)
* Added nx::core::filesystem::exists to wrap std::filesystem::exists * Wrapped std::filesystem calls in try-catch blocks * Currently only done for parameters to prevent issues during preflight --------- Signed-off-by: Jared Duffey <[email protected]>
- Loading branch information
Showing
5 changed files
with
147 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include "simplnx/Common/Result.hpp" | ||
|
||
#include <nonstd/expected.hpp> | ||
|
||
#include <filesystem> | ||
|
||
namespace nx::core::filesystem | ||
{ | ||
inline Result<bool> exists(const std::filesystem::path& path) | ||
{ | ||
std::error_code errorCode; | ||
bool result = std::filesystem::exists(path, errorCode); | ||
if(errorCode) | ||
{ | ||
return MakeErrorResult<bool>(errorCode.value(), errorCode.message()); | ||
} | ||
return {result}; | ||
} | ||
} // namespace nx::core::filesystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters