sdmc_factory.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <memory>
  5. #include "common/common_types.h"
  6. #include "common/logging/log.h"
  7. #include "common/string_util.h"
  8. #include "core/core.h"
  9. #include "core/file_sys/disk_filesystem.h"
  10. #include "core/file_sys/sdmc_factory.h"
  11. namespace FileSys {
  12. SDMC_Factory::SDMC_Factory(std::string sd_directory) : sd_directory(std::move(sd_directory)) {}
  13. ResultVal<std::unique_ptr<FileSystemBackend>> SDMC_Factory::Open(const Path& path) {
  14. // Create the SD Card directory if it doesn't already exist.
  15. if (!FileUtil::IsDirectory(sd_directory)) {
  16. FileUtil::CreateFullPath(sd_directory);
  17. }
  18. auto archive = std::make_unique<Disk_FileSystem>(sd_directory);
  19. return MakeResult<std::unique_ptr<FileSystemBackend>>(std::move(archive));
  20. }
  21. ResultCode SDMC_Factory::Format(const Path& path) {
  22. LOG_ERROR(Service_FS, "Unimplemented Format archive {}", GetName());
  23. // TODO(Subv): Find the right error code for this
  24. return ResultCode(-1);
  25. }
  26. ResultVal<ArchiveFormatInfo> SDMC_Factory::GetFormatInfo(const Path& path) const {
  27. LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
  28. // TODO(bunnei): Find the right error code for this
  29. return ResultCode(-1);
  30. }
  31. } // namespace FileSys