diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/errors.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/game_list.cpp | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index bb4654366..1a920b45d 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | namespace FileSys { | 9 | namespace FileSys { |
| 10 | 10 | ||
| 11 | constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; | 11 | constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; |
| 12 | constexpr ResultCode ERROR_PATH_ALREADY_EXISTS{ErrorModule::FS, 2}; | ||
| 12 | constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; | 13 | constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; |
| 13 | constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; | 14 | constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; |
| 14 | constexpr ResultCode ERROR_OUT_OF_BOUNDS{ErrorModule::FS, 3005}; | 15 | constexpr ResultCode ERROR_OUT_OF_BOUNDS{ErrorModule::FS, 3005}; |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 72ad273b2..67b2b3102 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -55,10 +55,15 @@ std::string VfsDirectoryServiceWrapper::GetName() const { | |||
| 55 | ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { | 55 | ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { |
| 56 | std::string path(Common::FS::SanitizePath(path_)); | 56 | std::string path(Common::FS::SanitizePath(path_)); |
| 57 | auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); | 57 | auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); |
| 58 | // dir can be nullptr if path contains subdirectories, create those prior to creating the file. | ||
| 59 | if (dir == nullptr) { | 58 | if (dir == nullptr) { |
| 60 | dir = backing->CreateSubdirectory(Common::FS::GetParentPath(path)); | 59 | return FileSys::ERROR_PATH_NOT_FOUND; |
| 60 | } | ||
| 61 | |||
| 62 | const auto entry_type = GetEntryType(path); | ||
| 63 | if (entry_type.Code() == RESULT_SUCCESS) { | ||
| 64 | return FileSys::ERROR_PATH_ALREADY_EXISTS; | ||
| 61 | } | 65 | } |
| 66 | |||
| 62 | auto file = dir->CreateFile(Common::FS::GetFilename(path)); | 67 | auto file = dir->CreateFile(Common::FS::GetFilename(path)); |
| 63 | if (file == nullptr) { | 68 | if (file == nullptr) { |
| 64 | // TODO(DarkLordZach): Find a better error code for this | 69 | // TODO(DarkLordZach): Find a better error code for this |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 827bc10e7..63cf82f7d 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -623,7 +623,8 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { | |||
| 623 | // move the treeview items | 623 | // move the treeview items |
| 624 | QList<QStandardItem*> item = item_model->takeRow(row); | 624 | QList<QStandardItem*> item = item_model->takeRow(row); |
| 625 | item_model->invisibleRootItem()->insertRow(row - 1, item); | 625 | item_model->invisibleRootItem()->insertRow(row - 1, item); |
| 626 | tree_view->setExpanded(selected, UISettings::values.game_dirs[game_dir_index].expanded); | 626 | tree_view->setExpanded(selected.sibling(row - 1, 0), |
| 627 | UISettings::values.game_dirs[other_index].expanded); | ||
| 627 | }); | 628 | }); |
| 628 | 629 | ||
| 629 | connect(move_down, &QAction::triggered, [this, selected, row, game_dir_index] { | 630 | connect(move_down, &QAction::triggered, [this, selected, row, game_dir_index] { |
| @@ -638,7 +639,8 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { | |||
| 638 | // move the treeview items | 639 | // move the treeview items |
| 639 | const QList<QStandardItem*> item = item_model->takeRow(row); | 640 | const QList<QStandardItem*> item = item_model->takeRow(row); |
| 640 | item_model->invisibleRootItem()->insertRow(row + 1, item); | 641 | item_model->invisibleRootItem()->insertRow(row + 1, item); |
| 641 | tree_view->setExpanded(selected, UISettings::values.game_dirs[game_dir_index].expanded); | 642 | tree_view->setExpanded(selected.sibling(row + 1, 0), |
| 643 | UISettings::values.game_dirs[other_index].expanded); | ||
| 642 | }); | 644 | }); |
| 643 | 645 | ||
| 644 | connect(open_directory_location, &QAction::triggered, [this, game_dir_index] { | 646 | connect(open_directory_location, &QAction::triggered, [this, game_dir_index] { |