mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-26 19:36:38 +08:00
Always delete lasturls file when changing value.
This commit is contained in:
parent
42dbb3bb5f
commit
ddb18e3058
@ -47,11 +47,18 @@ static Result remoteinstall_set_last_urls(const char* urls) {
|
|||||||
FS_Archive sdmcArchive = 0;
|
FS_Archive sdmcArchive = 0;
|
||||||
if(R_SUCCEEDED(res = FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")))) {
|
if(R_SUCCEEDED(res = FSUSER_OpenArchive(&sdmcArchive, ARCHIVE_SDMC, fsMakePath(PATH_EMPTY, "")))) {
|
||||||
FS_Path path = fsMakePath(PATH_ASCII, "/fbi/lasturls");
|
FS_Path path = fsMakePath(PATH_ASCII, "/fbi/lasturls");
|
||||||
if(urls == NULL || strlen(urls) == 0) {
|
|
||||||
res = FSUSER_DeleteFile(sdmcArchive, path);
|
|
||||||
} else if(R_SUCCEEDED(res = util_ensure_dir(sdmcArchive, "/fbi/"))) {
|
|
||||||
Handle file = 0;
|
Handle file = 0;
|
||||||
if(R_SUCCEEDED(res = FSUSER_OpenFile(&file, sdmcArchive, path, FS_OPEN_WRITE | FS_OPEN_CREATE, 0))) {
|
if(R_SUCCEEDED(FSUSER_OpenFile(&file, sdmcArchive, path, FS_OPEN_READ, 0))) {
|
||||||
|
FSFILE_Close(file);
|
||||||
|
|
||||||
|
res = FSUSER_DeleteFile(sdmcArchive, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(urls != NULL && strlen(urls) != 0
|
||||||
|
&& R_SUCCEEDED(res)
|
||||||
|
&& R_SUCCEEDED(res = util_ensure_dir(sdmcArchive, "/fbi/"))
|
||||||
|
&& R_SUCCEEDED(res = FSUSER_OpenFile(&file, sdmcArchive, path, FS_OPEN_WRITE | FS_OPEN_CREATE, 0))) {
|
||||||
u32 bytesWritten = 0;
|
u32 bytesWritten = 0;
|
||||||
res = FSFILE_Write(file, &bytesWritten, 0, urls, strlen(urls), FS_WRITE_FLUSH | FS_WRITE_UPDATE_TIME);
|
res = FSFILE_Write(file, &bytesWritten, 0, urls, strlen(urls), FS_WRITE_FLUSH | FS_WRITE_UPDATE_TIME);
|
||||||
|
|
||||||
@ -60,7 +67,6 @@ static Result remoteinstall_set_last_urls(const char* urls) {
|
|||||||
res = closeRes;
|
res = closeRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Result closeRes = FSUSER_CloseArchive(sdmcArchive);
|
Result closeRes = FSUSER_CloseArchive(sdmcArchive);
|
||||||
if(R_SUCCEEDED(res)) {
|
if(R_SUCCEEDED(res)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user