diff --git a/source/fatfs/alias.h b/source/fatfs/alias.h index 20c942c..a06846a 100644 --- a/source/fatfs/alias.h +++ b/source/fatfs/alias.h @@ -14,6 +14,8 @@ typedef struct { FRESULT fx_open (FIL* fp, XFIL* xfp, const TCHAR* path, BYTE mode); FRESULT fx_read (FIL* fp, XFIL* xfp, void* buff, UINT btr, UINT* br); FRESULT fx_write (FIL* fp, XFIL* xfp, const void* buff, UINT btw, UINT* bw); + +void dealias_path (TCHAR* alias, const TCHAR* path); FRESULT fa_open (FIL* fp, const TCHAR* path, BYTE mode); FRESULT fa_opendir (DIR* dp, const TCHAR* path); FRESULT fa_stat (const TCHAR* path, FILINFO* fno); diff --git a/source/fs.c b/source/fs.c index 9a8dadc..9dd3542 100644 --- a/source/fs.c +++ b/source/fs.c @@ -98,6 +98,12 @@ int PathToNumFS(const char* path) { return fsnum; } +int PathToNumFSA(const char* path) { + char alias[256]; + dealias_path(alias, path); + return PathToNumFS(alias); +} + bool IsSearchDrive(const char* path) { return *search_pattern && *search_path && (strncmp(path, "Z:", 3) == 0); } @@ -1213,7 +1219,7 @@ uint64_t GetFreeSpace(const char* path) DWORD free_clusters; FATFS *fs_ptr; char fsname[4] = { '\0' }; - int pdrv = PathToNumFS(path); + int pdrv = PathToNumFSA(path); if (pdrv < 0) return 0; snprintf(fsname, 3, "%i:", pdrv); @@ -1225,7 +1231,7 @@ uint64_t GetFreeSpace(const char* path) uint64_t GetTotalSpace(const char* path) { - int pdrv = PathToNumFS(path); + int pdrv = PathToNumFSA(path); if (pdrv < 0) return 0; return (uint64_t) (fs[pdrv].n_fatent - 2) * fs[pdrv].csize * _MAX_SS; @@ -1233,7 +1239,7 @@ uint64_t GetTotalSpace(const char* path) uint64_t GetPartitionOffsetSector(const char* path) { - int pdrv = PathToNumFS(path); + int pdrv = PathToNumFSA(path); if (pdrv < 0) return -1; return (uint64_t) fs[pdrv].volbase;