Test catching tc::UnauthorisedAccessException when testing if a directory isn't present.

This commit is contained in:
Jack 2023-06-04 15:58:21 +08:00
parent 7abcedb7e5
commit 17b40911ae

View file

@ -107,6 +107,8 @@ void nstool::FsProcess::extractFs()
// otherwise determine if this is a file or subdirectory
try {
std::shared_ptr<tc::io::IStream> 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
}