View previous topic :: View next topic |
Author |
Message |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Fri Jan 16, 2009 11:21 pm Post subject: Application.startupPath gives UTF error |
|
|
Try adding Application.startupPath to one of the examples of dfl 0.9.8. I put it in treeview.d.
It gives me this error:
Code: |
tango.core.Exception.UnicodeException: Unicode.toString32 : invalid utf8 input
|
Tango version is 0.99.7. DMD version is 1.037.
Windows Vista.
[edit] I figured out the problem(s). See follow-up messages.
Short answer is that dfl.internal.dlib.pathGetDirName needs to be changed to this for Windows+Tango 0.99.7:
Code: |
Dstring pathGetDirName(Dstring s)
{
scope mypath = new FilePath(tango.io.Path.standard(s));
return mypath.path();
}
|
Last edited by baxissimo on Sat Jan 17, 2009 12:37 am; edited 1 time in total |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Sat Jan 17, 2009 12:17 am Post subject: More info |
|
|
I built a debug build of tango so I could get a stack trace. Turns out there are several things going on here at once.
First the toString32 Utf8 error is actually coming from treeview's call to messageBox that is just happening on the tail end of everything going wrong.
The exception itself is coming from Tango about the path. tango.io.FilePath doesn't like file names with '\' in them in 0.99.7. Everything has to be a '/'. You can see that message in the stack trace below. Looks like they have wised up and changed this behavior in the current Tango trunk, but the DFL site says DFL is supposed to work with 0.99.7, and 0.99.7 is the latest released version of Tango. That bug still exists, and I'm going to file it just after this.
The final thing is why there is garbage in the toString of the exception that Tango throws. That appears to be a bug in Tango. It should be throwing with the string path[0..end] instead of 'path' in PathParser.parse. |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Sat Jan 17, 2009 12:18 am Post subject: The stack trace |
|
|
The forum barfed on the stack trace. Here's another attempt at posting it:
Here's the stack trace:
Quote: |
Code: |
path dir name of: 'F:\usr\pkg\d\dmd\packages\dfl\examples\treeview.exe'
Unhandled D Exception (tango.core.Exception.UnicodeException
"Unicode.toString32 : invalid utf8 input") at KERNEL32.dll (0x75bf42eb) thread(5696)
->us
#0 ?? () at ..\..\..\import\dfl\internal\dlib.d:345 from KERNEL32.dll
#1 0x00466c44 in __d_throw@4 () at ..\..\..\import\dfl\internal\dlib.d:345 from
deh
#2 0x00464750 in wchar[] tango.text.convert.Utf.toString16(char[], wchar[], uint*) () at ..\..\..\import\dfl\internal\dlib.d:345 from Utf
#3 0x00405fef in dfl.internal.dlib.utf8stringToUtf16stringz (s = "unexpected '\\' character in path: F:\\usr\\pkg\\d\\dmd\\packages\\dfl\\examples\\treeview.exe ") at ..\..\..\import\dfl\internal\dlib.d:345
#4 0x0040c6d6 in dfl.internal.utf.toUnicodez (utf8 = "unexpected '\\' character in path: F:\\usr\\pkg\\d\\dmd\\packages\\dfl\\examples\\treeview.exe ") at ..\..\..\import\dfl\internal\utf.d:398
#5 0x0040cf61 in dfl.internal.utf.messageBox () at ..\..\..\import\dfl\internal\utf.d:1433
#6 0x0043af64 in dfl.base.DialogResult dfl.messagebox.msgBox () at ..\..\..\import\dfl\messagebox.d:106
#7 0x00404bc0 in _Dmain () at treeview.d:353
#8 0x00466a5c in extern (C) int dmain2.main(int, char**) . void runMain(void*) () from dmain2
#9 0x00466a93 in extern (C) int dmain2.main(int, char**) . void runAll(void*) () from dmain2
#10 0x004667d4 in _main () from dmain2
#11 0x00470265 in _mainCRTStartup () from constart
#12 0x75bf4911 in ?? () from KERNEL32.dll
#13 0x7712e4b6 in ?? () from ntdll.dll
#14 0x7712e489 in ?? () from ntdll.dll
|
|
|
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Mon Jan 19, 2009 8:20 pm Post subject: Re: Application.startupPath gives UTF error |
|
|
Thanks for tracking down the issue! I committed the fix to subversion. |
|
Back to top |
|
|
|