"novice2" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
    homeDrive = toString(getenv("HOMEDRIVE")).dup;
    homePath = toString(getenv("HOMEPATH")).dup;

don't forget, that D char[] is utf8 and windows char* is 8-bit chars, not utf8. so you should import std.windows.charset and use toMBSz() as D->WindowsAPI and fromMBSz as WindowsAPI->D string converter. for example:
homeDrive = fromMBSz(getenv("HOMEDRIVE")).dup;

Under what setups can the drive letter be a non-ASCII character?

But according to my experiments, getenv works in the OEM encoding rather than the Windows encoding, so you'd need

   homePath = fromMBSz(getenv("HOMEPATH"), 1).dup;

If you want to make sure all Unicode characters are preserved, you're best off using the Windows API

   wchar[] wpath;
   wpath.length = GetEnvironmentVariableW("HOMEPATH", null, 0);
   GetEnvironmentVariableW("HOMEPATH", wpath.ptr, wpath.length);

Stewart.

--
My e-mail address is valid but not my primary mailbox. Please keep replies on the 'group where everybody may benefit.

Reply via email to