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 IncrementalPostProcessorHost(IncrementalPostProcessorsContext increContext, string postProcessorName, IImmutableList <SourceFileInfo> sourceFileInfos) { if (increContext == null) { throw new ArgumentNullException(nameof(increContext)); } if (postProcessorName == null) { throw new ArgumentNullException(nameof(postProcessorName)); } _increContext = increContext; _postProcessorName = postProcessorName; SourceFileInfos = sourceFileInfos; ShouldTraceIncrementalInfo = _increContext.ShouldTraceIncrementalInfo; IsIncremental = _increContext.IsIncremental; var b = FileAbstractLayerBuilder.Default; if (increContext.LastBaseDir != null) { b = b.ReadFromRealFileSystem(increContext.LastBaseDir); } _fal = b.WriteToRealFileSystem(increContext.CurrentBaseDir).Create(); }
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); }