🐛 修复路径可能为空导致创建相对路径报错的问题
This commit is contained in:
@@ -159,21 +159,7 @@ namespace GeekDesk.Util
|
|||||||
|
|
||||||
public static string MakeRelativePath(string fromPath, string toPath)
|
public static string MakeRelativePath(string fromPath, string toPath)
|
||||||
{
|
{
|
||||||
//if (string.IsNullOrEmpty(fromPath)) throw new ArgumentNullException("fromPath");
|
if (string.IsNullOrEmpty(toPath) || string.IsNullOrEmpty(fromPath)) return null;
|
||||||
//if (string.IsNullOrEmpty(toPath)) throw new ArgumentNullException("toPath");
|
|
||||||
|
|
||||||
//Uri fromUri = new Uri(fromPath);
|
|
||||||
//Uri toUri = new Uri(toPath);
|
|
||||||
|
|
||||||
//if (fromUri.Scheme != toUri.Scheme) { return toPath; } // path can't be made relative.
|
|
||||||
|
|
||||||
//Uri relativeUri = fromUri.MakeRelativeUri(toUri);
|
|
||||||
//string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
|
|
||||||
|
|
||||||
//if (toUri.Scheme.Equals("file", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
//{
|
|
||||||
// relativePath = relativePath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
|
||||||
//}
|
|
||||||
Uri file = new Uri(@toPath);
|
Uri file = new Uri(@toPath);
|
||||||
// Must end in a slash to indicate folder
|
// Must end in a slash to indicate folder
|
||||||
Uri folder = new Uri(@fromPath);
|
Uri folder = new Uri(@fromPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user