/// <summary> /// Creates a file transfer if the source and destination are different. /// </summary> /// <param name="source">Source path to file.</param> /// <param name="destination">Destination path for file.</param> /// <param name="move">File if file should be moved (optimal).</param> /// <param name="type">Optional type of file this transfer is transferring.</param> /// <param name="sourceLineNumbers">Optional source line numbers wher this transfer originated.</param> /// <returns>true if the source and destination are the different, false if no file transfer is created.</returns> public static bool TryCreate(string source, string destination, bool move, string type, SourceLineNumber sourceLineNumbers, out FileTransfer transfer) { string sourceFullPath = GetValidatedFullPath(sourceLineNumbers, source); string fileLayoutFullPath = GetValidatedFullPath(sourceLineNumbers, destination); // if the current source path (where we know that the file already exists) and the resolved // path as dictated by the Directory table are not the same, then propagate the file. The // image that we create may have already been done by some other process other than the linker, so // there is no reason to copy the files to the resolved source if they are already there. if (String.Equals(sourceFullPath, fileLayoutFullPath, StringComparison.OrdinalIgnoreCase)) { transfer = null; return(false); } transfer = new FileTransfer(source, destination, move, type, sourceLineNumbers); return(true); }