/// <summary> /// Check and modify source and destination file based on input and output directory existence, and a set of configuration values /// </summary> /// <param name="config">The config.</param> /// <param name="file">The file.</param> private void CheckAndModifySourceAndDestination(RenderConfigConfig config, ITargetFile file) { //Check to see if we want to preserve the directory structure.... file.source = CleansePlatformSpecificDirectoryMarkers(file.source); FileInfo t = new FileInfo(file.source); if (config.PreserveSourceStructure) { if (file.destination == null) { file.destination = file.source; } else { //TODO This is broken if (file.source.IndexOf(t.Name) != Path.DirectorySeparatorChar) { char badSep = file.source[file.source.IndexOf(t.Name)]; file.source.Replace(badSep, Path.DirectorySeparatorChar); } file.destination = Path.Combine(file.source.Replace(t.Name, string.Empty), file.destination); } } //Now check to see if the input directory has been provided, and modify the file object to represent the change of relative path if so if (config.InputDirectory != null) { file.source = Path.Combine(config.InputDirectory, file.source); } else { file.source = t.FullName; } LogUtilities.LogTargetFileHeader(file.source, file.destination, config.InputDirectory, config.OutputDirectory, log); //Check if it exists now... if (!File.Exists(file.source)) { throw new Exception("Could not find source file " + file.source); } }