diff options
| author | 2021-06-28 00:27:28 -0400 | |
|---|---|---|
| committer | 2021-06-28 10:08:08 -0400 | |
| commit | 6ac978426c68270ff022e719f7544251d42b19cf (patch) | |
| tree | b5eaac9d31559efa4263910c4ccd4c2ec3671c93 /src/core/hle | |
| parent | core: Simplify SDMC mod loading (diff) | |
| download | yuzu-6ac978426c68270ff022e719f7544251d42b19cf.tar.gz yuzu-6ac978426c68270ff022e719f7544251d42b19cf.tar.xz yuzu-6ac978426c68270ff022e719f7544251d42b19cf.zip | |
filesystem: Open a read-only directory for SDMC mods
This prevents mod files from being locked due to the read-only share flag in Windows.
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index d66e74d3a..4a9b13e45 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -743,20 +743,23 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove | |||
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | using YuzuPath = Common::FS::YuzuPath; | 745 | using YuzuPath = Common::FS::YuzuPath; |
| 746 | const auto sdmc_dir_path = Common::FS::GetYuzuPath(YuzuPath::SDMCDir); | ||
| 747 | const auto sdmc_load_dir_path = sdmc_dir_path / "atmosphere/contents"; | ||
| 746 | const auto rw_mode = FileSys::Mode::ReadWrite; | 748 | const auto rw_mode = FileSys::Mode::ReadWrite; |
| 747 | 749 | ||
| 748 | auto nand_directory = | 750 | auto nand_directory = |
| 749 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::NANDDir), rw_mode); | 751 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::NANDDir), rw_mode); |
| 750 | auto sd_directory = | 752 | auto sd_directory = vfs.OpenDirectory(Common::FS::PathToUTF8String(sdmc_dir_path), rw_mode); |
| 751 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::SDMCDir), rw_mode); | ||
| 752 | auto load_directory = | 753 | auto load_directory = |
| 753 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::LoadDir), FileSys::Mode::Read); | 754 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::LoadDir), FileSys::Mode::Read); |
| 755 | auto sd_load_directory = | ||
| 756 | vfs.OpenDirectory(Common::FS::PathToUTF8String(sdmc_load_dir_path), FileSys::Mode::Read); | ||
| 754 | auto dump_directory = | 757 | auto dump_directory = |
| 755 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::DumpDir), rw_mode); | 758 | vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::DumpDir), rw_mode); |
| 756 | 759 | ||
| 757 | if (bis_factory == nullptr) { | 760 | if (bis_factory == nullptr) { |
| 758 | bis_factory = | 761 | bis_factory = std::make_unique<FileSys::BISFactory>( |
| 759 | std::make_unique<FileSys::BISFactory>(nand_directory, load_directory, dump_directory); | 762 | nand_directory, std::move(load_directory), std::move(dump_directory)); |
| 760 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SysNAND, | 763 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SysNAND, |
| 761 | bis_factory->GetSystemNANDContents()); | 764 | bis_factory->GetSystemNANDContents()); |
| 762 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::UserNAND, | 765 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::UserNAND, |
| @@ -769,7 +772,8 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove | |||
| 769 | } | 772 | } |
| 770 | 773 | ||
| 771 | if (sdmc_factory == nullptr) { | 774 | if (sdmc_factory == nullptr) { |
| 772 | sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); | 775 | sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory), |
| 776 | std::move(sd_load_directory)); | ||
| 773 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SDMC, | 777 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SDMC, |
| 774 | sdmc_factory->GetSDMCContents()); | 778 | sdmc_factory->GetSDMCContents()); |
| 775 | } | 779 | } |