www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5927] New: Broken getcwd when using GetCurrentDirectoryA

reply d-bugmail puremagic.com writes:
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



---
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 04 2011
next sibling parent d-bugmail puremagic.com writes:
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



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 04 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5927




---

 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: -------
May 04 2011
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Jun 14 2011