Empty string should not be a directory.

This commit is contained in:
Themaister 2012-01-20 18:09:53 +01:00
parent 5edf67bba8
commit c492195ab1

2
file.c
View File

@ -936,6 +936,8 @@ void dir_list_free(char **dir_list)
bool path_is_directory(const char *path) bool path_is_directory(const char *path)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (!*path) // In Win32, an empty string is apparently a directory ...
return false;
return GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY; return GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY;
#elif defined(__CELLOS_LV2__) || defined(XENON) #elif defined(__CELLOS_LV2__) || defined(XENON)
// Dummy // Dummy