Fix trying to copy copyFiles where source==destination.
1 parent 8cdd917 commit c747339831ea8fd5b0a8abf7ec2f011035884d73
@Sönke Ludwig Sönke Ludwig authored on 25 Aug 2014
Showing 2 changed files
View
6
source/dub/generators/generator.d
foreach (f; buildsettings.copyFiles) {
auto src = Path(f);
if (!src.absolute) src = pack_path ~ src;
auto dst = target_path ~ Path(f).head;
if (src == dst) {
logDiagnostic("Skipping copy of %s (same source and destination)", f);
continue;
}
logDiagnostic(" %s to %s", src.toNativeString(), dst.toNativeString());
try {
copyFile(src, dst, true);
} catch logWarn("Failed to copy to %s", dst.toNativeString());
} catch(Exception e) logWarn("Failed to copy to %s: %s", dst.toNativeString(), e.msg);
}
}
}
}
View
2
■■■
source/dub/internal/vibecompat/core/file.d
An Exception if the copy operation fails for some reason.
*/
void copyFile(Path from, Path to, bool overwrite = false)
{
enforce(existsFile(from), "Source file doesn not exist.");
 
if (existsFile(to)) {
enforce(overwrite, "Destination file already exists.");
// remove file before copy to allow "overwriting" files that are in
// use on Linux