mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-25 21:15:36 +00:00
filesystem: Create subdirectories prior to creating a file
If subdirectories exist in the given path parameter and don't exist in the real filesystem create them prior to creating the files within. This fixes the softlocks upon save creation in The Legend of Zelda: Breath of the Wild
This commit is contained in:
parent
f26f53f35b
commit
2079bb4090
|
@ -55,6 +55,9 @@ std::string VfsDirectoryServiceWrapper::GetName() const {
|
||||||
ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
|
ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const {
|
||||||
std::string path(FileUtil::SanitizePath(path_));
|
std::string path(FileUtil::SanitizePath(path_));
|
||||||
auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path));
|
auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path));
|
||||||
|
if (dir == nullptr) {
|
||||||
|
dir = backing->CreateSubdirectory(FileUtil::GetParentPath(path));
|
||||||
|
}
|
||||||
auto file = dir->CreateFile(FileUtil::GetFilename(path));
|
auto file = dir->CreateFile(FileUtil::GetFilename(path));
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
// TODO(DarkLordZach): Find a better error code for this
|
// TODO(DarkLordZach): Find a better error code for this
|
||||||
|
|
Loading…
Reference in a new issue