Skip to content

Commit 2528943

Browse files
committed
copy/move to other profiles includes saveinfo.xml
1 parent 53fb62b commit 2528943

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/savemng.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ int copySavedataToOtherDevice(Title *title, Title *titleb, int8_t source_user, i
14171417

14181418
switch (source_user) {
14191419
case -3: // not posible
1420-
promptError("source_user=-3 is not allowed for this task");
1420+
promptError(LanguageUtils::gettext("source_user=-3 is not allowed for this task"));
14211421
if (removeDir(dstPath))
14221422
unlink(dstPath.c_str());
14231423
return -1;
@@ -1445,9 +1445,7 @@ int copySavedataToOtherDevice(Title *title, Title *titleb, int8_t source_user, i
14451445

14461446
std::string errorMessage {};
14471447
if (doCommon) {
1448-
#ifndef MOCK
14491448
FSAMakeQuota(handle, newlibtoFSA(dstCommonPath).c_str(), 0x666, titleb->commonSaveSize);
1450-
#endif
14511449
if (! copyDir(srcCommonPath, dstCommonPath)) {
14521450
errorMessage = LanguageUtils::gettext("Error copying common savedata.");
14531451
errorCode = 1;
@@ -1474,14 +1472,14 @@ int copySavedataToOtherDevice(Title *title, Title *titleb, int8_t source_user, i
14741472
if ( initializeWiiUTitle(titleb, errorMessage, errorCode) )
14751473
goto restoreSaveinfo;
14761474
else
1477-
goto end;
1475+
goto flush_volume;
14781476

14791477
}
14801478

14811479
restoreSaveinfo:
14821480
updateSaveinfo(titleb, source_user, wiiu_user, COPY_TO_OTHER_DEVICE, 0, title, errorMessage, errorCode);
14831481

1484-
end:
1482+
flush_volume:
14851483
flushVol(dstPath);
14861484

14871485
if (errorCode != 0) {
@@ -1529,14 +1527,16 @@ int copySavedataToOtherProfile(Title *title, int8_t source_user, int8_t wiiu_use
15291527

15301528
std::string errorMessage {};
15311529

1532-
#ifndef MOCK
15331530
FSAMakeQuota(handle, newlibtoFSA(dstPath).c_str(), 0x666, title->accountSaveSize);
1534-
#endif
15351531
if (! copyDir(srcPath, dstPath)) {
15361532
errorMessage = LanguageUtils::gettext("Error copying profile savedata.");
15371533
errorCode = 1;
1534+
goto flush_volume;
15381535
}
1536+
1537+
updateSaveinfo(title, source_user, wiiu_user, PROFILE_TO_PROFILE, 0, title, errorMessage, errorCode);
15391538

1539+
flush_volume:
15401540
flushVol(dstPath);
15411541

15421542
if (errorCode != 0) {
@@ -1596,6 +1596,7 @@ int moveSavedataToOtherProfile(Title *title, int8_t source_user, int8_t wiiu_use
15961596
splitStringWithNewLines(srcPath,multilinePath);
15971597
errorMessage = StringUtils::stringFormat(LanguageUtils::gettext("Unable to rename folder \n'%s'to\n'%s'\n\n%s\n\nPlease restore the backup, fix errors and try again"),multilinePath.c_str(),dstPath.c_str(),strerror(errno));
15981598
errorCode = 2;
1599+
goto flush_volume;
15991600
}
16001601
if (InProgress::totalSteps > 1) { // It's so fast that is unnecessary ...
16011602
InProgress::input->read();
@@ -1605,6 +1606,10 @@ int moveSavedataToOtherProfile(Title *title, int8_t source_user, int8_t wiiu_use
16051606
}
16061607
}
16071608

1609+
1610+
updateSaveinfo(title, source_user, wiiu_user, MOVE_PROFILE, 0, title, errorMessage, errorCode);
1611+
1612+
flush_volume:
16081613
flushVol(dstPath);
16091614

16101615
if ( errorCode != 0 ) {
@@ -1796,7 +1801,7 @@ int backupSavedata(Title *title, uint8_t slot, int8_t source_user, bool common,
17961801

17971802
switch (source_user) {
17981803
case -3: // not possible
1799-
promptError("source_user=-3 is not allowed for this task");
1804+
promptError(LanguageUtils::gettext("source_user=-3 is not allowed for this task"));
18001805
if (removeDir(dstPath))
18011806
unlink(dstPath.c_str());
18021807
return -1;
@@ -1913,7 +1918,7 @@ int restoreSavedata(Title *title, uint8_t slot, int8_t source_user, int8_t wiiu_
19131918

19141919
switch (source_user) {
19151920
case -3: // not posible
1916-
promptError("source_user=-3 is not allowed for this task");
1921+
promptError(LanguageUtils::gettext("source_user=-3 is not allowed for this task"));
19171922
if (removeDir(dstPath))
19181923
unlink(dstPath.c_str());
19191924
return -1;
@@ -1937,9 +1942,7 @@ int restoreSavedata(Title *title, uint8_t slot, int8_t source_user, int8_t wiiu_
19371942

19381943
std::string errorMessage {};
19391944
if (doCommon) {
1940-
#ifndef MOCK
19411945
FSAMakeQuota(handle, newlibtoFSA(dstCommonPath).c_str(), 0x666, title->commonSaveSize);
1942-
#endif
19431946
if (! copyDir(srcCommonPath, dstCommonPath)) {
19441947
errorMessage.append("\n" + (std::string)LanguageUtils::gettext("Error restoring common savedata."));
19451948
errorCode = 1;
@@ -1962,23 +1965,23 @@ int restoreSavedata(Title *title, uint8_t slot, int8_t source_user, int8_t wiiu_
19621965

19631966
if (!title->saveInit && title->is_Inject) {
19641967
initializeVWiiInjectTitle(title, errorMessage, errorCode);
1965-
goto end;
1968+
goto flush_volume;
19661969
}
19671970

19681971
if (!title->saveInit && ! isWii ) {
19691972

19701973
if ( initializeWiiUTitle(title, errorMessage, errorCode) )
19711974
goto restoreSaveinfo;
19721975
else
1973-
goto end;
1976+
goto flush_volume;
19741977

19751978
}
19761979

19771980
restoreSaveinfo:
19781981
if (! isWii )
19791982
updateSaveinfo(title, source_user, wiiu_user, RESTORE, slot, title, errorMessage, errorCode);
19801983

1981-
end:
1984+
flush_volume:
19821985
flushVol(dstPath);
19831986

19841987
if (errorCode != 0) {

0 commit comments

Comments
 (0)