Add helper method DiffPaths
This commit is contained in:
parent
877aff9548
commit
6d1d58ff9a
|
@ -70,15 +70,16 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if a file is a symbolic link
|
// Check if a file is a symbolic link
|
||||||
public static bool IsSymlink (string file)
|
public static bool IsSymlink (string file)
|
||||||
{
|
{
|
||||||
FileAttributes attr = File.GetAttributes (file);
|
FileAttributes attr = File.GetAttributes (file);
|
||||||
|
|
||||||
return ((attr & FileAttributes.ReparsePoint) ==
|
return ((attr & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint);
|
||||||
FileAttributes.ReparsePoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Converts a UNIX timestamp to a more usable time object
|
// Converts a UNIX timestamp to a more usable time object
|
||||||
public static DateTime UnixTimestampToDateTime (int timestamp)
|
public static DateTime UnixTimestampToDateTime (int timestamp)
|
||||||
{
|
{
|
||||||
|
@ -86,4 +87,11 @@ namespace SparkleLib {
|
||||||
return unix_epoch.AddSeconds (timestamp);
|
return unix_epoch.AddSeconds (timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets the relative path of two hierarchical absolute paths
|
||||||
|
public static string DiffPaths (string target, string source)
|
||||||
|
{
|
||||||
|
return target.Replace (source + Path.DirectorySeparatorChar, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue