forked from Mirror/GodMode9
Fix: Recognizing file locks due to alias mounts
This commit is contained in:
parent
bf2ce1a37c
commit
da7599d05c
@ -101,11 +101,13 @@ bool SetupBonusDrive(void) {
|
|||||||
|
|
||||||
bool FileUnlock(const char* path) {
|
bool FileUnlock(const char* path) {
|
||||||
FIL file;
|
FIL file;
|
||||||
|
FRESULT res;
|
||||||
|
|
||||||
if (!(DriveType(path) & DRV_FAT)) return true; // can't really check this
|
if (!(DriveType(path) & DRV_FAT)) return true; // can't really check this
|
||||||
if (fx_open(&file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK) {
|
if ((res = fx_open(&file, path, FA_READ | FA_OPEN_EXISTING)) != FR_OK) {
|
||||||
char pathstr[32 + 1];
|
char pathstr[32 + 1];
|
||||||
TruncateString(pathstr, path, 32, 8);
|
TruncateString(pathstr, path, 32, 8);
|
||||||
if (GetMountState() && (strncasecmp(path, GetMountPath(), 256) == 0) &&
|
if (GetMountState() && (res == FR_LOCKED) &&
|
||||||
(ShowPrompt(true, "%s\nFile is currently mounted.\nUnmount to unlock?", pathstr))) {
|
(ShowPrompt(true, "%s\nFile is currently mounted.\nUnmount to unlock?", pathstr))) {
|
||||||
InitImgFS(NULL);
|
InitImgFS(NULL);
|
||||||
if (fx_open(&file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK)
|
if (fx_open(&file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK)
|
||||||
@ -113,6 +115,7 @@ bool FileUnlock(const char* path) {
|
|||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
fx_close(&file);
|
fx_close(&file);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user