Summary: Broken getcwd when using GetCurrentDirectoryA
           Product: D
           Version: D1 & D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos

--- Comment #0 from Denis <> 2011-05-04 10:27:28 PDT 
On Windows 98 getcwd returnes path in windows multy-byte format (not ASCII),
but should convert it to utf-8 first. And it leads to utf-8 validation
exception in std.utf.

File: src\phobos\std\file.d

Trivial solution:

-1704:  auto dir =
            new char[enforce(GetCurrentDirectoryA(0, null), "getcwd")];
        dir = dir[0 .. GetCurrentDirectoryA(dir.length, dir.ptr)];
        cenforce(dir.length, "getcwd");
        return assumeUnique(dir);

+1704:  auto dirA =
            new char[enforce(GetCurrentDirectoryA(0, null), "getcwd")];
        GetCurrentDirectoryA(dirA.length, dirA.ptr);
        string dir = fromMBSz(cast(immutable)dirA.ptr);
        enforce(dir.length, "getcwd");
        return dir;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to