The following program works as expected because both the source file and the destination directory exist:
import std.file;
void main() {
copy("/home/master/temp/foo.txt", "/home/master/foo.txt");
}
Changing the second argument to this:
import std.file;
void main() {
copy("/home/master/temp/foo.txt", "/home/master/baz/foo.txt");
}
causes the program to fail because there is no /home/master/baz directory. But the error message is
std.file.FileException@std/file.d(2315): /home/master/temp/foo.txt: No such file or directory
That's confusing because the file does exist. The correct message would be
std.file.FileException@std/file.d(2315): /home/master/temp: No such directory
Comment #1 by lt.infiltrator — 2015-11-16T01:51:47Z
This has been fixed in 2.069:
std.file.FileException@std/file.d(3139): baz/bar.txt: No such file or directory
=========
import std.file;
void main() {
write("foo.txt", "abc");
copy("foo.txt", "baz/bar.txt");
}
=========