Skip to content

Commit

Permalink
Expand short paths, when resolving to absolute path values.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jump committed May 14, 2020
1 parent 6dcc74b commit 4d2b9e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions uSync8.BackOffice/Services/SyncFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private void BackOfficeConfig_Reloaded(uSyncSettings settings)
public string GetAbsPath(string path)
{
if (IsLocalPath(path)) return CleanLocalPath(path);
return IOHelper.MapPath(path.TrimStart('/'));
return CleanLocalPath(IOHelper.MapPath(path.TrimStart('/')));
}

/// <summary>
Expand Down Expand Up @@ -73,8 +73,11 @@ private bool IsDirectorySeparator(char c)
private bool IsValidDriveChar(char value)
=> ((value >= 'A' && value <= 'Z') || (value >= 'a' && value <= 'z'));

/// <summary>
/// clean up the local path, and full expand any short file names
/// </summary>
private string CleanLocalPath(string path)
=> path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
=> Path.GetFullPath(path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));

public bool FileExists(string path)
=> File.Exists(GetAbsPath(path));
Expand Down

0 comments on commit 4d2b9e3

Please sign in to comment.