Use lstat instead of stat.

This commit is contained in:
Steve Checkoway
2004-01-12 06:48:44 +00:00
parent 96a7cb0bcd
commit ae0fd0ac1a
+7 -4
View File
@@ -20,7 +20,8 @@ void split(const CString& Source, const CString& Deliminator, vector<CString>& A
{
unsigned startpos = 0;
do {
do
{
unsigned pos = Source.find(Deliminator, startpos);
if (pos == Source.npos) pos=Source.size();
@@ -28,15 +29,17 @@ void split(const CString& Source, const CString& Deliminator, vector<CString>& A
AddIt.push_back(AddCString);
startpos=pos+Deliminator.size();
} while (startpos <= Source.size());
}
while (startpos <= Source.size());
}
bool IsADirectory(const CString& path)
{
struct stat s;
if (stat(path, &s))
if (lstat(path, &s))
return false;
return (s.st_mode & S_IFDIR) && !(s.st_mode & S_IFLNK);
return ((s.st_mode & S_IFDIR) == S_IFDIR) &&
((s.st_mode & S_IFLNK) != S_IFLNK);
}
bool DoesFileExist(const CString& path)