diff --git a/Common/File/DirListing.cpp b/Common/File/DirListing.cpp index 1140c64d7e..36f05b9259 100644 --- a/Common/File/DirListing.cpp +++ b/Common/File/DirListing.cpp @@ -197,7 +197,7 @@ size_t GetFilesInDir(const Path &directory, std::vector * files, const info.size = 0; info.isWritable = false; // TODO - implement some kind of check if (!info.isDirectory) { - std::string ext = Path(info.fullName).GetFileExtension(); + std::string ext = info.fullName.GetFileExtension(); if (!ext.empty()) { ext = ext.substr(1); // Remove the dot. if (filter && filters.find(ext) == filters.end()) { diff --git a/Common/File/PathBrowser.cpp b/Common/File/PathBrowser.cpp index 25fbe86cca..61797f2a1b 100644 --- a/Common/File/PathBrowser.cpp +++ b/Common/File/PathBrowser.cpp @@ -258,7 +258,7 @@ bool PathBrowser::GetListing(std::vector &fileInfo, const char * fileInfo = ApplyFilter(pendingFiles_, filter); return true; } else { - File::GetFilesInDir(Path(path_), &fileInfo, filter); + File::GetFilesInDir(path_, &fileInfo, filter); return true; } } diff --git a/Core/Config.cpp b/Core/Config.cpp index 5664828011..27a5b7507d 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1593,7 +1593,7 @@ void Config::RestoreDefaults() { createGameConfig(gameId_); } else { if (File::Exists(iniFilename_)) - File::Delete(Path(iniFilename_)); + File::Delete(iniFilename_); recentIsos.clear(); currentDirectory = ""; } diff --git a/Core/HLE/Plugins.cpp b/Core/HLE/Plugins.cpp index f4d7367a4b..1647c6d55a 100644 --- a/Core/HLE/Plugins.cpp +++ b/Core/HLE/Plugins.cpp @@ -86,8 +86,8 @@ static std::vector FindPlugins(const std::string &gameID, const std: GetFilesInDir(GetSysDirectory(DIRECTORY_PLUGINS), &pluginDirs); std::vector found; - for (auto subdir : pluginDirs) { - Path subdirFullName(subdir.fullName); + for (const auto &subdir : pluginDirs) { + const Path &subdirFullName = subdir.fullName; if (!subdir.isDirectory || !File::Exists(subdirFullName / "plugin.ini")) continue; diff --git a/Core/System.cpp b/Core/System.cpp index bdbe292b7e..0fc1cc48d7 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -676,7 +676,7 @@ void InitSysDirectories() { INFO_LOG(COMMON, "Memstick directory not present, creating at '%s'", g_Config.memStickDirectory.c_str()); } - Path testFile = Path(g_Config.memStickDirectory) / "_writable_test.$$$"; + Path testFile = g_Config.memStickDirectory / "_writable_test.$$$"; // If any directory is read-only, fall back to the Documents directory. // We're screwed anyway if we can't write to Documents, or can't detect it. diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index b3eb8e8c0b..b5df4ee94f 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -696,7 +696,7 @@ void ReplacedTexture::Load(int level, void *out, int rowPitch) { png_image png = {}; png.version = PNG_IMAGE_VERSION; - FILE *fp = File::OpenCFile(Path(info.file), "rb"); + FILE *fp = File::OpenCFile(info.file, "rb"); if (!png_image_begin_read_from_stdio(&png, fp)) { ERROR_LOG(G3D, "Could not load texture replacement info: %s - %s", info.file.c_str(), png.message); return; @@ -733,7 +733,7 @@ bool TextureReplacer::GenerateIni(const std::string &gameID, Path &generatedFile if (gameID.empty()) return false; - Path texturesDirectory = Path(GetSysDirectory(DIRECTORY_TEXTURES)) / gameID; + Path texturesDirectory = GetSysDirectory(DIRECTORY_TEXTURES) / gameID; if (!File::Exists(texturesDirectory)) { File::CreateFullPath(texturesDirectory); } diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index f72977d67f..b77d81e6d3 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -580,7 +580,7 @@ bool GameManager::InstallMemstickGame(struct zip *z, const Path &zipfile, const installInProgress_ = false; installError_ = ""; if (deleteAfter) { - File::Delete(Path(zipfile)); + File::Delete(zipfile); } InstallDone(); return true; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 592d23f182..f920e079a6 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -62,7 +62,7 @@ bool GameInfo::Delete() { case IdentifiedFileType::PSP_ISO_NP: { // Just delete the one file (TODO: handle two-disk games as well somehow). - Path fileToRemove = Path(filePath_); + Path fileToRemove = filePath_; File::Delete(fileToRemove); g_Config.RemoveRecent(filePath_.ToString()); return true; @@ -134,7 +134,7 @@ std::vector GameInfo::GetSaveDataDirectories() { } for (size_t i = 0; i < dirs.size(); i++) { if (startsWith(dirs[i].name, id)) { - directories.push_back(Path(dirs[i].fullName)); + directories.push_back(dirs[i].fullName); } } @@ -155,7 +155,7 @@ u64 GameInfo::GetSaveDataSizeInBytes() { // Note: GetFilesInDir does not fill in fileSize properly. for (size_t i = 0; i < fileInfo.size(); i++) { File::FileInfo finfo; - File::GetFileInfo(Path(fileInfo[i].fullName), &finfo); + File::GetFileInfo(fileInfo[i].fullName, &finfo); if (!finfo.isDirectory) filesSizeInDir += finfo.size; } @@ -182,7 +182,7 @@ u64 GameInfo::GetInstallDataSizeInBytes() { // Note: GetFilesInDir does not fill in fileSize properly. for (size_t i = 0; i < fileInfo.size(); i++) { File::FileInfo finfo; - File::GetFileInfo(Path(fileInfo[i].fullName), &finfo); + File::GetFileInfo(fileInfo[i].fullName, &finfo); if (!finfo.isDirectory) filesSizeInDir += finfo.size; } @@ -235,7 +235,7 @@ bool GameInfo::DeleteAllSaveData() { File::GetFilesInDir(saveDataDir[j], &fileInfo); for (size_t i = 0; i < fileInfo.size(); i++) { - File::Delete(Path(fileInfo[i].fullName)); + File::Delete(fileInfo[i].fullName); } File::DeleteDir(saveDataDir[j]); @@ -493,7 +493,7 @@ handleELF: // Let's use the screenshot as an icon, too. Path screenshotPath = gamePath_.WithReplacedExtension("ppst", "jpg"); if (File::Exists(screenshotPath)) { - if (File::ReadFileToString(false, Path(screenshotPath), info_->icon.data)) { + if (File::ReadFileToString(false, screenshotPath, info_->icon.data)) { info_->icon.dataLoaded = true; } else { ERROR_LOG(G3D, "Error loading screenshot data: '%s'", screenshotPath.c_str()); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index fea5ff2e85..bc1be681f6 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1772,7 +1772,7 @@ UI::EventReturn DeveloperToolsScreen::OnCopyStatesToRoot(UI::EventParams &e) { GetFilesInDir(savestate_dir, &files, nullptr, 0); for (const File::FileInfo &file : files) { - Path src = Path(file.fullName); + Path src = file.fullName; Path dst = root_dir / file.name; INFO_LOG(SYSTEM, "Copying file '%s' to '%s'", src.c_str(), dst.c_str()); File::Copy(src, dst); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 295b99f07a..feed38bd5e 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -429,7 +429,7 @@ static void ClearFailedGPUBackends() { // In case they update drivers and have totally different problems much later, clear the failed list. g_Config.sFailedGPUBackends.clear(); if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) { - File::Delete(Path(GetSysDirectory(DIRECTORY_APP_CACHE)) / "FailedGraphicsBackends.txt"); + File::Delete(GetSysDirectory(DIRECTORY_APP_CACHE) / "FailedGraphicsBackends.txt"); } else { g_Config.Save("clearFailedGPUBackends"); } @@ -1004,7 +1004,7 @@ void NativeShutdownGraphics() { void TakeScreenshot() { g_TakeScreenshot = false; - Path path = Path(GetSysDirectory(DIRECTORY_SCREENSHOT)); + Path path = GetSysDirectory(DIRECTORY_SCREENSHOT); if (!File::Exists(path)) { File::CreateDir(path); } diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index d8853a80ab..f6d89b663c 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -159,7 +159,7 @@ void AsyncImageFileView::Draw(UIContext &dc) { class ScreenshotViewScreen : public PopupScreen { public: - ScreenshotViewScreen(Path filename, std::string title, int slot, std::shared_ptr i18n) + ScreenshotViewScreen(const Path &filename, std::string title, int slot, std::shared_ptr i18n) : PopupScreen(title, i18n->T("Load State"), "Back"), filename_(filename), slot_(slot) {} // PopupScreen will translate Back on its own int GetSlot() const { diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index fe426a4a61..97fe8cb6d1 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -114,7 +114,7 @@ public: } else { Path image_path = savePath_.WithReplacedExtension(".ppst", ".jpg"); if (File::Exists(image_path)) { - toprow->Add(new AsyncImageFileView(Path(image_path), IS_KEEP_ASPECT, new LinearLayoutParams(480, 272, Margins(10, 0)))); + toprow->Add(new AsyncImageFileView(image_path, IS_KEEP_ASPECT, new LinearLayoutParams(480, 272, Margins(10, 0)))); } else { toprow->Add(new TextView(sa->T("No screenshot"), new LinearLayoutParams(Margins(10, 5))))->SetTextColor(textStyle.fgColor); } diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 4939ccb9e8..17b2c82d22 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -96,8 +96,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptrLocalFolder->Path->Data(); - - g_Config.memStickDirectory = Path(ReplaceAll(ConvertWStringToUTF8(memstickFolderW), "\\", "/")); + g_Config.memStickDirectory = Path(memstickFolderW); // On Win32 it makes more sense to initialize the system directories here // because the next place it was called was in the EmuThread, and it's too late by then.