do not attempt to change file attributes of symlinks

This commit is contained in:
Jan Funke 2011-10-01 20:08:05 +02:00
parent 18ace1afc1
commit 1a91c6d9c2

View file

@ -65,10 +65,19 @@ namespace SparkleLib {
string [] files = Directory .GetFiles(path);
foreach (string file in files)
File.SetAttributes (file, FileAttributes.Normal);
if (!IsSymlink (file))
File.SetAttributes (file, FileAttributes.Normal);
}
}
// Check if a file is a symbolic link
public static bool IsSymlink (string file)
{
FileAttributes attr = File.GetAttributes (file);
return ((attr & FileAttributes.ReparsePoint) ==
FileAttributes.ReparsePoint);
}
// Converts a UNIX timestamp to a more usable time object
public static DateTime UnixTimestampToDateTime (int timestamp)