diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 742fbb546f..d84b725e70 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -932,7 +932,7 @@ static void RebuildUserDirectories(unsigned int dir_index) { case D_USER_IDX: s_user_paths[D_GCUSER_IDX] = s_user_paths[D_USER_IDX] + GC_USER_DIR DIR_SEP; - s_user_paths[D_WIIROOT_IDX] = s_user_paths[D_USER_IDX] + WII_USER_DIR; + s_user_paths[D_WIIROOT_IDX] = s_user_paths[D_USER_IDX] + WII_USER_DIR DIR_SEP; s_user_paths[D_CONFIG_IDX] = s_user_paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; s_user_paths[D_GAMESETTINGS_IDX] = s_user_paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP; s_user_paths[D_MAPS_IDX] = s_user_paths[D_USER_IDX] + MAPS_DIR DIR_SEP; @@ -978,7 +978,7 @@ static void RebuildUserDirectories(unsigned int dir_index) s_user_paths[F_ARAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + ARAM_DUMP; s_user_paths[F_FAKEVMEMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + FAKEVMEM_DUMP; s_user_paths[F_GCSRAM_IDX] = s_user_paths[D_GCUSER_IDX] + GC_SRAM; - s_user_paths[F_WIISDCARD_IDX] = s_user_paths[D_WIIROOT_IDX] + DIR_SEP WII_SDCARD; + s_user_paths[F_WIISDCARD_IDX] = s_user_paths[D_WIIROOT_IDX] + WII_SDCARD; s_user_paths[D_MEMORYWATCHER_IDX] = s_user_paths[D_USER_IDX] + MEMORYWATCHER_DIR DIR_SEP; s_user_paths[F_MEMORYWATCHERLOCATIONS_IDX] = diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 13dd1f2ce0..8fc33200d7 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -19,7 +19,9 @@ namespace Common std::string RootUserPath(FromWhichRoot from) { int idx = from == FROM_CONFIGURED_ROOT ? D_WIIROOT_IDX : D_SESSION_WIIROOT_IDX; - return File::GetUserPath(idx); + std::string dir = File::GetUserPath(idx); + dir.pop_back(); // remove trailing path separator + return dir; } static std::string RootUserPath(std::optional from) diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index b586dcee8f..2e2fee3f87 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -117,6 +117,8 @@ HostFileSystem::HostFileSystem(const std::string& root_path, std::vector nand_redirects) : m_root_path{root_path}, m_nand_redirects(std::move(nand_redirects)) { + while (StringEndsWith(m_root_path, "/")) + m_root_path.pop_back(); File::CreateFullPath(m_root_path + "/"); ResetFst(); LoadFst(); diff --git a/Source/Core/Core/IOS/IOSC.cpp b/Source/Core/Core/IOS/IOSC.cpp index 5f4461efbe..a937bad1ff 100644 --- a/Source/Core/Core/IOS/IOSC.cpp +++ b/Source/Core/Core/IOS/IOSC.cpp @@ -557,7 +557,7 @@ void IOSC::LoadDefaultEntries(ConsoleType console_type) void IOSC::LoadEntries() { - File::IOFile file{File::GetUserPath(D_WIIROOT_IDX) + "/keys.bin", "rb"}; + File::IOFile file{File::GetUserPath(D_WIIROOT_IDX) + "keys.bin", "rb"}; if (!file) { WARN_LOG_FMT(IOS, "keys.bin could not be found. Default values will be used."); diff --git a/Source/Core/Core/WiiRoot.cpp b/Source/Core/Core/WiiRoot.cpp index 149eb50627..de26bd4cf1 100644 --- a/Source/Core/Core/WiiRoot.cpp +++ b/Source/Core/Core/WiiRoot.cpp @@ -65,14 +65,14 @@ static bool CopyBackupFile(const std::string& path_from, const std::string& path static void DeleteBackupFile(const std::string& file_name) { - File::Delete(File::GetUserPath(D_BACKUP_IDX) + DIR_SEP + file_name); + File::Delete(File::GetUserPath(D_BACKUP_IDX) + file_name); } static void BackupFile(const std::string& path_in_nand) { const std::string file_name = PathToFileName(path_in_nand); - const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP + path_in_nand; - const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + DIR_SEP + file_name; + const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + path_in_nand; + const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + file_name; CopyBackupFile(original_path, backup_path); } @@ -80,8 +80,8 @@ static void BackupFile(const std::string& path_in_nand) static void RestoreFile(const std::string& path_in_nand) { const std::string file_name = PathToFileName(path_in_nand); - const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP + path_in_nand; - const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + DIR_SEP + file_name; + const std::string original_path = File::GetUserPath(D_WIIROOT_IDX) + path_in_nand; + const std::string backup_path = File::GetUserPath(D_BACKUP_IDX) + file_name; if (CopyBackupFile(backup_path, original_path)) DeleteBackupFile(file_name); diff --git a/Source/Core/DiscIO/NANDImporter.cpp b/Source/Core/DiscIO/NANDImporter.cpp index c836661813..ea72c3e6c4 100644 --- a/Source/Core/DiscIO/NANDImporter.cpp +++ b/Source/Core/DiscIO/NANDImporter.cpp @@ -34,10 +34,9 @@ void NANDImporter::ImportNANDBin(const std::string& path_to_bin, if (!ReadNANDBin(path_to_bin, get_otp_dump_path)) return; - const std::string nand_root = File::GetUserPath(D_WIIROOT_IDX); + std::string nand_root = File::GetUserPath(D_WIIROOT_IDX); + nand_root.pop_back(); // remove trailing path separator m_nand_root_length = nand_root.length(); - if (nand_root.back() == '/') - m_nand_root_length++; FindSuperblock(); ProcessEntry(0, nand_root);