Thread overview
[Issue 5927] New: Broken getcwd when using GetCurrentDirectoryA
May 04, 2011
Denis
May 05, 2011
Andrej Mitrovic
May 05, 2011
Denis
Jun 14, 2011
Denis
May 04, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5927

           Summary: Broken getcwd when using GetCurrentDirectoryA
           Product: D
           Version: D1 & D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com


--- Comment #0 from Denis <verylonglogin.reg@gmail.com> 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5927


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-05-04 17:54:18 PDT ---
This is silly. Do you expect the Phobos library to work around every single Windows bug for outdated Windows operating systems that not even Microsoft supports?

Win98 support ended in 2006, I really don't see why anyone would care for this OS, D isn't legacy software.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5927



--- Comment #2 from Denis <verylonglogin.reg@gmail.com> 2011-05-04 23:51:02 PDT ---
(In reply to comment #1)
> This is silly. Do you expect the Phobos library to work around every single Windows bug for outdated Windows operating systems that not even Microsoft supports?
> 
> Win98 support ended in 2006, I really don't see why anyone would care for this OS, D isn't legacy software.

First. Why silly? If Phobos doesn't support Win98, why there are lots of code
to support if? If this code exists it should work. If Win98 realy isn't
supported, all such code should be removed.
Second. It isn't a bug of Win98. It's a bug of Phobos.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5927


Denis <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------