예제 #1
0
    public DirectoryPath(string relativePath)
    {
        relativePath = IFileSystemExt.CleanDirectorySeparators(relativePath);
#if NETSTANDARD2_0
        relativePath = relativePath.TrimEnd('/').TrimEnd('\\');
#else
        relativePath = System.IO.Path.TrimEndingDirectorySeparator(relativePath);
#endif
        _originalPath = relativePath;
        _fullPath     = relativePath == string.Empty ? string.Empty : System.IO.Path.GetFullPath(relativePath);
    }
    private string GetTestFile(string path)
    {
        var ret = File.ReadAllText(path);

        if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            ret = ret.Replace("C:", string.Empty);
            ret = ret.Replace("\\\\", $"{Path.DirectorySeparatorChar}");
            ret = IFileSystemExt.CleanDirectorySeparators(ret);
        }
        return(ret);
    }
예제 #3
0
 public FilePath(string relativePath)
 {
     relativePath  = IFileSystemExt.CleanDirectorySeparators(relativePath);
     _originalPath = relativePath;
     _fullPath     = relativePath == string.Empty ? string.Empty : System.IO.Path.GetFullPath(relativePath);
 }