diff options
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 3452259..0714344 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -3198,8 +3198,16 @@ bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName) bool SystemTools::FileIsSymlink(const kwsys_stl::string& name) { #if defined( _WIN32 ) - (void)name; - return false; + DWORD attr = GetFileAttributesW( + SystemTools::ConvertToWindowsExtendedPath(name).c_str()); + if (attr != INVALID_FILE_ATTRIBUTES) + { + return (attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0; + } + else + { + return false; + } #else struct stat fs; if(lstat(name.c_str(), &fs) == 0) @@ -4230,6 +4238,11 @@ SystemTools::DetectFileType(const char *filename, return SystemTools::FileTypeUnknown; } + if (SystemTools::FileIsDirectory(filename)) + { + return SystemTools::FileTypeUnknown; + } + FILE *fp = Fopen(filename, "rb"); if (!fp) { @@ -4243,6 +4256,7 @@ SystemTools::DetectFileType(const char *filename, fclose(fp); if (read_length == 0) { + delete [] buffer; return SystemTools::FileTypeUnknown; } |