Core: Fix a few misuses of FS::CreateDirectory
CreateDirectory does not create missing parent directories. If that behaviour is desired, CreateFullPath should be used instead. (These small misuses went unnoticed since the previous implementation of CreateDirectory automatically created parent directories.)
This commit is contained in:
parent
36676d2628
commit
8f74d02659
|
@ -904,7 +904,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||||
{
|
{
|
||||||
auto buffer = DecompressPacketIntoBuffer(packet);
|
auto buffer = DecompressPacketIntoBuffer(packet);
|
||||||
|
|
||||||
temp_fs->CreateDirectory(IOS::PID_KERNEL, IOS::PID_KERNEL, "/shared2/menu/FaceLib", 0,
|
temp_fs->CreateFullPath(IOS::PID_KERNEL, IOS::PID_KERNEL, "/shared2/menu/FaceLib/", 0,
|
||||||
fs_modes);
|
fs_modes);
|
||||||
auto file = temp_fs->CreateAndOpenFile(IOS::PID_KERNEL, IOS::PID_KERNEL,
|
auto file = temp_fs->CreateAndOpenFile(IOS::PID_KERNEL, IOS::PID_KERNEL,
|
||||||
Common::GetMiiDatabasePath(), fs_modes);
|
Common::GetMiiDatabasePath(), fs_modes);
|
||||||
|
@ -924,8 +924,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||||
{
|
{
|
||||||
u64 title_id = Common::PacketReadU64(packet);
|
u64 title_id = Common::PacketReadU64(packet);
|
||||||
titles.push_back(title_id);
|
titles.push_back(title_id);
|
||||||
temp_fs->CreateDirectory(IOS::PID_KERNEL, IOS::PID_KERNEL,
|
temp_fs->CreateFullPath(IOS::PID_KERNEL, IOS::PID_KERNEL,
|
||||||
Common::GetTitleDataPath(title_id), 0, fs_modes);
|
Common::GetTitleDataPath(title_id) + '/', 0, fs_modes);
|
||||||
auto save = WiiSave::MakeNandStorage(temp_fs.get(), title_id);
|
auto save = WiiSave::MakeNandStorage(temp_fs.get(), title_id);
|
||||||
|
|
||||||
bool exists;
|
bool exists;
|
||||||
|
|
|
@ -34,9 +34,8 @@ static std::string s_temp_wii_root;
|
||||||
|
|
||||||
static void CopySave(FS::FileSystem* source, FS::FileSystem* dest, const u64 title_id)
|
static void CopySave(FS::FileSystem* source, FS::FileSystem* dest, const u64 title_id)
|
||||||
{
|
{
|
||||||
dest->CreateDirectory(IOS::PID_KERNEL, IOS::PID_KERNEL, Common::GetTitleDataPath(title_id), 0,
|
dest->CreateFullPath(IOS::PID_KERNEL, IOS::PID_KERNEL, Common::GetTitleDataPath(title_id) + '/',
|
||||||
{IOS::HLE::FS::Mode::ReadWrite, IOS::HLE::FS::Mode::ReadWrite,
|
0, {FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::ReadWrite});
|
||||||
IOS::HLE::FS::Mode::ReadWrite});
|
|
||||||
const auto source_save = WiiSave::MakeNandStorage(source, title_id);
|
const auto source_save = WiiSave::MakeNandStorage(source, title_id);
|
||||||
const auto dest_save = WiiSave::MakeNandStorage(dest, title_id);
|
const auto dest_save = WiiSave::MakeNandStorage(dest, title_id);
|
||||||
WiiSave::Copy(source_save.get(), dest_save.get());
|
WiiSave::Copy(source_save.get(), dest_save.get());
|
||||||
|
@ -49,9 +48,8 @@ static bool CopyNandFile(FS::FileSystem* source_fs, const std::string& source_fi
|
||||||
if (last_slash != std::string::npos && last_slash > 0)
|
if (last_slash != std::string::npos && last_slash > 0)
|
||||||
{
|
{
|
||||||
const std::string dir = dest_file.substr(0, last_slash);
|
const std::string dir = dest_file.substr(0, last_slash);
|
||||||
dest_fs->CreateDirectory(IOS::PID_KERNEL, IOS::PID_KERNEL, dir, 0,
|
dest_fs->CreateFullPath(IOS::PID_KERNEL, IOS::PID_KERNEL, dir + '/', 0,
|
||||||
{IOS::HLE::FS::Mode::ReadWrite, IOS::HLE::FS::Mode::ReadWrite,
|
{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::ReadWrite});
|
||||||
IOS::HLE::FS::Mode::ReadWrite});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto source_handle =
|
auto source_handle =
|
||||||
|
@ -190,7 +188,7 @@ static bool CopySysmenuFilesToFS(FS::FileSystem* fs, const std::string& host_sou
|
||||||
|
|
||||||
if (entry.isDirectory)
|
if (entry.isDirectory)
|
||||||
{
|
{
|
||||||
fs->CreateDirectory(IOS::SYSMENU_UID, IOS::SYSMENU_GID, nand_path, 0, public_modes);
|
fs->CreateFullPath(IOS::SYSMENU_UID, IOS::SYSMENU_GID, nand_path + '/', 0, public_modes);
|
||||||
if (!CopySysmenuFilesToFS(fs, host_path, nand_path))
|
if (!CopySysmenuFilesToFS(fs, host_path, nand_path))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -259,12 +257,8 @@ void CleanUpWiiFileSystemContents()
|
||||||
|
|
||||||
// FS won't write the save if the directory doesn't exist
|
// FS won't write the save if the directory doesn't exist
|
||||||
const std::string title_path = Common::GetTitleDataPath(title_id);
|
const std::string title_path = Common::GetTitleDataPath(title_id);
|
||||||
if (!configured_fs->GetMetadata(IOS::PID_KERNEL, IOS::PID_KERNEL, title_path))
|
configured_fs->CreateFullPath(IOS::PID_KERNEL, IOS::PID_KERNEL, title_path + '/', 0,
|
||||||
{
|
{FS::Mode::ReadWrite, FS::Mode::ReadWrite, FS::Mode::ReadWrite});
|
||||||
configured_fs->CreateDirectory(IOS::PID_KERNEL, IOS::PID_KERNEL, title_path, 0,
|
|
||||||
{IOS::HLE::FS::Mode::ReadWrite, IOS::HLE::FS::Mode::ReadWrite,
|
|
||||||
IOS::HLE::FS::Mode::ReadWrite});
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto user_save = WiiSave::MakeNandStorage(configured_fs.get(), title_id);
|
const auto user_save = WiiSave::MakeNandStorage(configured_fs.get(), title_id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue