private static string TranslateFilePath(string file) { if (string.IsNullOrEmpty(PathTrimPrefix) || string.IsNullOrEmpty(file)) { return(file); } file = file.NormalizePath(); if (!string.IsNullOrEmpty(PathTrimPrefix)) { if (file.StartsWith(PathTrimPrefix)) { file = file.Replace(PathTrimPrefix, ""); } else { file = FileAbstractLayer.RelativePath(file, PathTrimPrefix, false); } } if (!string.IsNullOrEmpty(FallbackPathTrimPrefix)) { file = file.Replace(FallbackPathTrimPrefix, "_repo.en-us" + Path.DirectorySeparatorChar); } return(file); }
public void FileAbstractLayer_RelativePath_Test(string path, string relativeTo, bool relativeToFile, string expected) { var result = FileAbstractLayer.RelativePath(path, relativeTo, relativeToFile); Assert.AreEqual <string>(expected, result); }