[Emulator] Added error checking while creating directories
This commit is contained in:
parent
f551e59015
commit
f19cb704aa
|
@ -883,9 +883,9 @@ void EmulatorWindow::InstallContent() {
|
||||||
// Normalize the path and make absolute.
|
// Normalize the path and make absolute.
|
||||||
auto abs_path = std::filesystem::absolute(path);
|
auto abs_path = std::filesystem::absolute(path);
|
||||||
auto result = emulator_->InstallContentPackage(abs_path);
|
auto result = emulator_->InstallContentPackage(abs_path);
|
||||||
if (XFAILED(result)) {
|
if (result != X_STATUS_SUCCESS) {
|
||||||
// TODO: Display a message box.
|
// TODO: Display a message box.
|
||||||
XELOGE("Failed to install content: {:08X}", result);
|
XELOGE("Failed to install content! Error code: {:08X}", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,7 +374,12 @@ X_STATUS Emulator::InstallContentPackage(const std::filesystem::path& path) {
|
||||||
// TODO: Popup
|
// TODO: Popup
|
||||||
// Do you want to overwrite already existing data?
|
// Do you want to overwrite already existing data?
|
||||||
} else {
|
} else {
|
||||||
std::filesystem::create_directories(installation_path / path.filename());
|
std::error_code error_code;
|
||||||
|
std::filesystem::create_directories(installation_path / path.filename(),
|
||||||
|
error_code);
|
||||||
|
if (error_code) {
|
||||||
|
return error_code.value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run through all the files, breadth-first style.
|
// Run through all the files, breadth-first style.
|
||||||
|
@ -396,7 +401,11 @@ X_STATUS Emulator::InstallContentPackage(const std::filesystem::path& path) {
|
||||||
auto dest_name =
|
auto dest_name =
|
||||||
installation_path / path.filename() / xe::to_path(entry->path());
|
installation_path / path.filename() / xe::to_path(entry->path());
|
||||||
if (entry->attributes() & vfs::kFileAttributeDirectory) {
|
if (entry->attributes() & vfs::kFileAttributeDirectory) {
|
||||||
std::filesystem::create_directories(dest_name);
|
std::error_code error_code;
|
||||||
|
std::filesystem::create_directories(dest_name, error_code);
|
||||||
|
if (error_code) {
|
||||||
|
return error_code.value();
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue