diff --git a/externals/cmake-modules/WindowsCopyFiles.cmake b/externals/cmake-modules/WindowsCopyFiles.cmake index cd0c2ce474..72cec53549 100644 --- a/externals/cmake-modules/WindowsCopyFiles.cmake +++ b/externals/cmake-modules/WindowsCopyFiles.cmake @@ -1,4 +1,4 @@ -# Copyright 2016 Citra Emulator Project +# Copyright 2018 Yuzu Emulator Project # Licensed under GPLv2 or any later version # Refer to the license.txt file included. @@ -22,7 +22,7 @@ function(windows_copy_files TARGET SOURCE_DIR DEST_DIR) # cmake adds an extra check for command success which doesn't work too well with robocopy # so trick it into thinking the command was successful with the || cmd /c "exit /b 0" add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND if not exist ${DEST_DIR} mkdir ${DEST_DIR} 2> nul + COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR} COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0" ) -endfunction() \ No newline at end of file +endfunction() diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index 0ed7d2a0ce..d3e9a3829f 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h @@ -11,6 +11,7 @@ namespace FileSys { namespace ErrCodes { enum { NotFound = 1, + SaveDataNotFound = 1002, }; } diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 216bfea0a6..82efe7f7db 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -7,6 +7,7 @@ #include "common/string_util.h" #include "core/core.h" #include "core/file_sys/directory.h" +#include "core/file_sys/errors.h" #include "core/file_sys/filesystem.h" #include "core/file_sys/storage.h" #include "core/hle/ipc_helpers.h" @@ -531,12 +532,20 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) { void FSP_SRV::MountSaveData(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_FS, "(STUBBED) called"); + // TODO(Subv): Read the input parameters and mount the requested savedata instead of always + // mounting the current process' savedata. FileSys::Path unused; - auto filesystem = OpenFileSystem(Type::SaveData, unused).Unwrap(); + auto filesystem = OpenFileSystem(Type::SaveData, unused); + + if (filesystem.Failed()) { + IPC::ResponseBuilder rb{ctx, 2, 0, 0}; + rb.Push(ResultCode(ErrorModule::FS, FileSys::ErrCodes::SaveDataNotFound)); + return; + } IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(std::move(filesystem)); + rb.PushIpcInterface(std::move(filesystem.Unwrap())); } void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {