mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-26 03:44:15 +01:00
Fixed entryFromPath bug when looking for "." in root directory
This commit is contained in:
parent
c93d8672e1
commit
9c7ddccd44
@ -31,6 +31,9 @@
|
|||||||
|
|
||||||
2006-08-17 - Chishm
|
2006-08-17 - Chishm
|
||||||
* entryFromPath doesn't look for "" anymore - use "." to refer to the current directory
|
* entryFromPath doesn't look for "" anymore - use "." to refer to the current directory
|
||||||
|
|
||||||
|
2006-08-19 - Chishm
|
||||||
|
* Fixed entryFromPath bug when looking for "." in root directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -434,8 +437,8 @@ bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const
|
|||||||
while (pathPosition[0] == DIR_SEPARATOR) {
|
while (pathPosition[0] == DIR_SEPARATOR) {
|
||||||
pathPosition++;
|
pathPosition++;
|
||||||
}
|
}
|
||||||
// If the path is only specifying a directory in the form of "" or ".", return it
|
// If the path is only specifying a directory in the form of "/" return it
|
||||||
if ((pathPosition >= pathEnd) || (strncasecmp(".", pathPosition, 2) == 0)) {
|
if (pathPosition >= pathEnd) {
|
||||||
_FAT_directory_getRootEntry (partition, entry);
|
_FAT_directory_getRootEntry (partition, entry);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@ -444,6 +447,13 @@ bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const
|
|||||||
dirCluster = partition->cwdCluster;
|
dirCluster = partition->cwdCluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the path is only specifying a directory in the form "."
|
||||||
|
// and this is the root directory, return it
|
||||||
|
if ((dirCluster == partition->rootDirCluster) && (strncasecmp(".", pathPosition, 2) == 0)) {
|
||||||
|
_FAT_directory_getRootEntry (partition, entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
while (!found && !notFound) {
|
while (!found && !notFound) {
|
||||||
// Get the name of the next required subdirectory within the path
|
// Get the name of the next required subdirectory within the path
|
||||||
nextPathPosition = strchr (pathPosition, DIR_SEPARATOR);
|
nextPathPosition = strchr (pathPosition, DIR_SEPARATOR);
|
||||||
|
Loading…
Reference in New Issue
Block a user