Bug 15330 – std.file.copy outputs wrong error message when target directory doesn't exist

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-11-13T20:03:00Z
Last change time
2015-11-16T01:51:47Z
Assigned to
nobody
Creator
lbach

Comments

Comment #0 by lbach — 2015-11-13T20:03:05Z
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"); } =========