[Issue 15330] New: std.file.copy outputs wrong error message when target directory doesn't exist

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Nov 13 12:03:05 PST 2015


https://issues.dlang.org/show_bug.cgi?id=15330

          Issue ID: 15330
           Summary: std.file.copy outputs wrong error message when target
                    directory doesn't exist
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: lbach at rocketmail.com

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 at 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 at std/file.d(2315): /home/master/temp: No such directory

--


More information about the Digitalmars-d-bugs mailing list