fix directly remounting the file which is already mounted

This commit is contained in:
aspargas2 2020-08-08 01:00:01 -04:00 committed by d0k3
parent f0ad45dd60
commit e5ffa885b6

View File

@ -60,7 +60,6 @@ const char* GetMountPath(void) {
} }
u64 MountImage(const char* path) { u64 MountImage(const char* path) {
u64 type = (path) ? IdentifyFileType(path) : 0;
if (mount_state) { if (mount_state) {
fvx_close(&mount_file); fvx_close(&mount_file);
if (fix_cmac) FixFileCmac(mount_path, false); if (fix_cmac) FixFileCmac(mount_path, false);
@ -68,6 +67,7 @@ u64 MountImage(const char* path) {
mount_state = 0; mount_state = 0;
*mount_path = 0; *mount_path = 0;
} }
u64 type = (path) ? IdentifyFileType(path) : 0;
if (!type) return 0; if (!type) return 0;
if ((fvx_open(&mount_file, path, FA_READ | FA_WRITE | FA_OPEN_EXISTING) != FR_OK) && if ((fvx_open(&mount_file, path, FA_READ | FA_WRITE | FA_OPEN_EXISTING) != FR_OK) &&
(fvx_open(&mount_file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK)) (fvx_open(&mount_file, path, FA_READ | FA_OPEN_EXISTING) != FR_OK))