mirror of
https://github.com/jakcron/nstool
synced 2024-11-22 21:49:30 +00:00
Test catching tc::UnauthorisedAccessException when testing if a directory isn't present.
This commit is contained in:
parent
7abcedb7e5
commit
17b40911ae
1 changed files with 6 additions and 0 deletions
|
@ -107,6 +107,8 @@ void nstool::FsProcess::extractFs()
|
||||||
// otherwise determine if this is a file or subdirectory
|
// otherwise determine if this is a file or subdirectory
|
||||||
try {
|
try {
|
||||||
std::shared_ptr<tc::io::IStream> file_stream;
|
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);
|
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());
|
//fmt::print("Valid File Path: \"{:s}\"\n", itr->virtual_path.to_string());
|
||||||
|
@ -132,6 +134,8 @@ void nstool::FsProcess::extractFs()
|
||||||
|
|
||||||
} catch (tc::io::DirectoryNotFoundException&) {
|
} catch (tc::io::DirectoryNotFoundException&) {
|
||||||
// acceptable exception, just means directory didn't exist
|
// 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
|
// 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;
|
continue;
|
||||||
} catch (tc::io::DirectoryNotFoundException&) {
|
} catch (tc::io::DirectoryNotFoundException&) {
|
||||||
// acceptable exception, just means the parent directory didn't exist
|
// acceptable exception, just means the parent directory didn't exist
|
||||||
|
} catch (tc::UnauthorisedAccessException&) {
|
||||||
|
// acceptable exception, just means directory didn't exist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue