summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2021-06-19 03:43:16 -0400
committerGravatar Morph2021-06-22 13:36:24 -0400
commit81b1b71993473b31321c8ff2d0dd0b267848a968 (patch)
tree3f2ab1041c7d819949fd68faa3dd21759f7ce2a9 /src
parentMerge pull request #6506 from ReinUsesLisp/master-semaphore-jthread (diff)
downloadyuzu-81b1b71993473b31321c8ff2d0dd0b267848a968.tar.gz
yuzu-81b1b71993473b31321c8ff2d0dd0b267848a968.tar.xz
yuzu-81b1b71993473b31321c8ff2d0dd0b267848a968.zip
common: fs: Remove [[nodiscard]] attribute on Remove* functions
There are a lot of scenarios where we don't particularly care whether or not the removal operation and just simply attempt a removal. As such, removing the [[nodiscard]] attribute is best for these functions.
Diffstat (limited to 'src')
-rw-r--r--src/common/fs/fs.h16
-rw-r--r--src/common/logging/backend.cpp2
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp4
-rw-r--r--src/video_core/vulkan_common/nsight_aftermath_tracker.cpp2
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.cpp4
-rw-r--r--src/yuzu/main.cpp24
6 files changed, 26 insertions, 26 deletions
diff --git a/src/common/fs/fs.h b/src/common/fs/fs.h
index f6f256349..cf7dfffcc 100644
--- a/src/common/fs/fs.h
+++ b/src/common/fs/fs.h
@@ -55,11 +55,11 @@ template <typename Path>
55 * 55 *
56 * @returns True if file removal succeeds or file does not exist, false otherwise. 56 * @returns True if file removal succeeds or file does not exist, false otherwise.
57 */ 57 */
58[[nodiscard]] bool RemoveFile(const std::filesystem::path& path); 58bool RemoveFile(const std::filesystem::path& path);
59 59
60#ifdef _WIN32 60#ifdef _WIN32
61template <typename Path> 61template <typename Path>
62[[nodiscard]] bool RemoveFile(const Path& path) { 62bool RemoveFile(const Path& path) {
63 if constexpr (IsChar<typename Path::value_type>) { 63 if constexpr (IsChar<typename Path::value_type>) {
64 return RemoveFile(ToU8String(path)); 64 return RemoveFile(ToU8String(path));
65 } else { 65 } else {
@@ -251,11 +251,11 @@ template <typename Path>
251 * 251 *
252 * @returns True if directory removal succeeds or directory does not exist, false otherwise. 252 * @returns True if directory removal succeeds or directory does not exist, false otherwise.
253 */ 253 */
254[[nodiscard]] bool RemoveDir(const std::filesystem::path& path); 254bool RemoveDir(const std::filesystem::path& path);
255 255
256#ifdef _WIN32 256#ifdef _WIN32
257template <typename Path> 257template <typename Path>
258[[nodiscard]] bool RemoveDir(const Path& path) { 258bool RemoveDir(const Path& path) {
259 if constexpr (IsChar<typename Path::value_type>) { 259 if constexpr (IsChar<typename Path::value_type>) {
260 return RemoveDir(ToU8String(path)); 260 return RemoveDir(ToU8String(path));
261 } else { 261 } else {
@@ -276,11 +276,11 @@ template <typename Path>
276 * 276 *
277 * @returns True if the directory and all of its contents are removed successfully, false otherwise. 277 * @returns True if the directory and all of its contents are removed successfully, false otherwise.
278 */ 278 */
279[[nodiscard]] bool RemoveDirRecursively(const std::filesystem::path& path); 279bool RemoveDirRecursively(const std::filesystem::path& path);
280 280
281#ifdef _WIN32 281#ifdef _WIN32
282template <typename Path> 282template <typename Path>
283[[nodiscard]] bool RemoveDirRecursively(const Path& path) { 283bool RemoveDirRecursively(const Path& path) {
284 if constexpr (IsChar<typename Path::value_type>) { 284 if constexpr (IsChar<typename Path::value_type>) {
285 return RemoveDirRecursively(ToU8String(path)); 285 return RemoveDirRecursively(ToU8String(path));
286 } else { 286 } else {
@@ -301,11 +301,11 @@ template <typename Path>
301 * 301 *
302 * @returns True if all of the directory's contents are removed successfully, false otherwise. 302 * @returns True if all of the directory's contents are removed successfully, false otherwise.
303 */ 303 */
304[[nodiscard]] bool RemoveDirContentsRecursively(const std::filesystem::path& path); 304bool RemoveDirContentsRecursively(const std::filesystem::path& path);
305 305
306#ifdef _WIN32 306#ifdef _WIN32
307template <typename Path> 307template <typename Path>
308[[nodiscard]] bool RemoveDirContentsRecursively(const Path& path) { 308bool RemoveDirContentsRecursively(const Path& path) {
309 if constexpr (IsChar<typename Path::value_type>) { 309 if constexpr (IsChar<typename Path::value_type>) {
310 return RemoveDirContentsRecursively(ToU8String(path)); 310 return RemoveDirContentsRecursively(ToU8String(path));
311 } else { 311 } else {
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index d5cff400f..47dba48ca 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -159,7 +159,7 @@ FileBackend::FileBackend(const std::filesystem::path& filename) {
159 159
160 // Existence checks are done within the functions themselves. 160 // Existence checks are done within the functions themselves.
161 // We don't particularly care if these succeed or not. 161 // We don't particularly care if these succeed or not.
162 void(FS::RemoveFile(old_filename)); 162 FS::RemoveFile(old_filename);
163 void(FS::RenameFile(filename, old_filename)); 163 void(FS::RenameFile(filename, old_filename));
164 164
165 file = 165 file =
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index a2844ea8c..dc15cf58b 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -313,7 +313,7 @@ void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGe
313 LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res); 313 LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
314 314
315 if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) { 315 if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) {
316 void(Common::FS::RemoveFile(zip_path)); 316 Common::FS::RemoveFile(zip_path);
317 } 317 }
318 318
319 HandleDownloadDisplayResult(applet_manager, res); 319 HandleDownloadDisplayResult(applet_manager, res);
@@ -445,7 +445,7 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
445 LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res); 445 LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
446 446
447 if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) { 447 if (res == DownloadResult::NoMatchBuildId || res == DownloadResult::NoMatchTitleId) {
448 void(Common::FS::RemoveFile(bin_file_path)); 448 Common::FS::RemoveFile(bin_file_path);
449 } 449 }
450 450
451 HandleDownloadDisplayResult(applet_manager, res); 451 HandleDownloadDisplayResult(applet_manager, res);
diff --git a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp
index f0ee76519..758c038ba 100644
--- a/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp
+++ b/src/video_core/vulkan_common/nsight_aftermath_tracker.cpp
@@ -50,7 +50,7 @@ NsightAftermathTracker::NsightAftermathTracker() {
50 } 50 }
51 dump_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::LogDir) / "gpucrash"; 51 dump_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::LogDir) / "gpucrash";
52 52
53 void(Common::FS::RemoveDirRecursively(dump_dir)); 53 Common::FS::RemoveDirRecursively(dump_dir);
54 if (!Common::FS::CreateDir(dump_dir)) { 54 if (!Common::FS::CreateDir(dump_dir)) {
55 LOG_ERROR(Render_Vulkan, "Failed to create Nsight Aftermath dump directory"); 55 LOG_ERROR(Render_Vulkan, "Failed to create Nsight Aftermath dump directory");
56 return; 56 return;
diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp
index 9b709d405..ebb0f411c 100644
--- a/src/yuzu/configuration/configure_per_game_addons.cpp
+++ b/src/yuzu/configuration/configure_per_game_addons.cpp
@@ -79,8 +79,8 @@ void ConfigurePerGameAddons::ApplyConfiguration() {
79 std::sort(disabled_addons.begin(), disabled_addons.end()); 79 std::sort(disabled_addons.begin(), disabled_addons.end());
80 std::sort(current.begin(), current.end()); 80 std::sort(current.begin(), current.end());
81 if (disabled_addons != current) { 81 if (disabled_addons != current) {
82 void(Common::FS::RemoveFile(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / 82 Common::FS::RemoveFile(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
83 "game_list" / fmt::format("{:016X}.pv.txt", title_id))); 83 "game_list" / fmt::format("{:016X}.pv.txt", title_id));
84 } 84 }
85 85
86 Settings::values.disabled_addons[title_id] = disabled_addons; 86 Settings::values.disabled_addons[title_id] = disabled_addons;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index d4c7d2c0b..75ab5ef44 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -194,10 +194,10 @@ static void RemoveCachedContents() {
194 const auto offline_legal_information = cache_dir / "offline_web_applet_legal_information"; 194 const auto offline_legal_information = cache_dir / "offline_web_applet_legal_information";
195 const auto offline_system_data = cache_dir / "offline_web_applet_system_data"; 195 const auto offline_system_data = cache_dir / "offline_web_applet_system_data";
196 196
197 void(Common::FS::RemoveDirRecursively(offline_fonts)); 197 Common::FS::RemoveDirRecursively(offline_fonts);
198 void(Common::FS::RemoveDirRecursively(offline_manual)); 198 Common::FS::RemoveDirRecursively(offline_manual);
199 void(Common::FS::RemoveDirRecursively(offline_legal_information)); 199 Common::FS::RemoveDirRecursively(offline_legal_information);
200 void(Common::FS::RemoveDirRecursively(offline_system_data)); 200 Common::FS::RemoveDirRecursively(offline_system_data);
201} 201}
202 202
203GMainWindow::GMainWindow() 203GMainWindow::GMainWindow()
@@ -1743,8 +1743,8 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
1743 RemoveAddOnContent(program_id, entry_type); 1743 RemoveAddOnContent(program_id, entry_type);
1744 break; 1744 break;
1745 } 1745 }
1746 void(Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / 1746 Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
1747 "game_list")); 1747 "game_list");
1748 game_list->PopulateAsync(UISettings::values.game_dirs); 1748 game_list->PopulateAsync(UISettings::values.game_dirs);
1749} 1749}
1750 1750
@@ -2213,8 +2213,8 @@ void GMainWindow::OnMenuInstallToNAND() {
2213 : tr("%n file(s) failed to install\n", "", failed_files.size())); 2213 : tr("%n file(s) failed to install\n", "", failed_files.size()));
2214 2214
2215 QMessageBox::information(this, tr("Install Results"), install_results); 2215 QMessageBox::information(this, tr("Install Results"), install_results);
2216 void(Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / 2216 Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
2217 "game_list")); 2217 "game_list");
2218 game_list->PopulateAsync(UISettings::values.game_dirs); 2218 game_list->PopulateAsync(UISettings::values.game_dirs);
2219 ui.action_Install_File_NAND->setEnabled(true); 2219 ui.action_Install_File_NAND->setEnabled(true);
2220} 2220}
@@ -2846,7 +2846,7 @@ void GMainWindow::MigrateConfigFiles() {
2846 LOG_INFO(Frontend, "Migrating config file from {} to {}", origin, destination); 2846 LOG_INFO(Frontend, "Migrating config file from {} to {}", origin, destination);
2847 if (!Common::FS::RenameFile(origin, destination)) { 2847 if (!Common::FS::RenameFile(origin, destination)) {
2848 // Delete the old config file if one already exists in the new location. 2848 // Delete the old config file if one already exists in the new location.
2849 void(Common::FS::RemoveFile(origin)); 2849 Common::FS::RemoveFile(origin);
2850 } 2850 }
2851 } 2851 }
2852} 2852}
@@ -3040,9 +3040,9 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
3040 3040
3041 const auto keys_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::KeysDir); 3041 const auto keys_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::KeysDir);
3042 3042
3043 void(Common::FS::RemoveFile(keys_dir / "prod.keys_autogenerated")); 3043 Common::FS::RemoveFile(keys_dir / "prod.keys_autogenerated");
3044 void(Common::FS::RemoveFile(keys_dir / "console.keys_autogenerated")); 3044 Common::FS::RemoveFile(keys_dir / "console.keys_autogenerated");
3045 void(Common::FS::RemoveFile(keys_dir / "title.keys_autogenerated")); 3045 Common::FS::RemoveFile(keys_dir / "title.keys_autogenerated");
3046 } 3046 }
3047 3047
3048 Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); 3048 Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();