From 17b40911aefabfbc7fd2b57e2197e83d753dd2df Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 4 Jun 2023 15:58:21 +0800 Subject: [PATCH] Test catching tc::UnauthorisedAccessException when testing if a directory isn't present. --- src/FsProcess.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/FsProcess.cpp b/src/FsProcess.cpp index ade3c21..375c582 100644 --- a/src/FsProcess.cpp +++ b/src/FsProcess.cpp @@ -107,6 +107,8 @@ void nstool::FsProcess::extractFs() // otherwise determine if this is a file or subdirectory try { std::shared_ptr file_stream; + + // this will throw tc::io::FileNotFoundException if the virtual path doesn't point to a file mInputFs->openFile(itr->virtual_path, tc::io::FileMode::Open, tc::io::FileAccess::Read, file_stream); //fmt::print("Valid File Path: \"{:s}\"\n", itr->virtual_path.to_string()); @@ -132,6 +134,8 @@ void nstool::FsProcess::extractFs() } catch (tc::io::DirectoryNotFoundException&) { // acceptable exception, just means directory didn't exist + } catch (tc::UnauthorisedAccessException&) { + // acceptable exception, just means directory didn't exist } // case: the extract_path up until the last element is a valid path to an existing directory, but the full path specifies neither a directory or a file @@ -157,6 +161,8 @@ void nstool::FsProcess::extractFs() continue; } catch (tc::io::DirectoryNotFoundException&) { // acceptable exception, just means the parent directory didn't exist + } catch (tc::UnauthorisedAccessException&) { + // acceptable exception, just means directory didn't exist }