View previous topic :: View next topic |
Author |
Message |
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Thu May 04, 2006 12:25 pm Post subject: FilePath/FileProxy problem. |
|
|
The following code shows that the FilePath objects are getting scrambled somehow:
Code: |
/*
* Compile using:
* build path0 -full -clean -version=Win32SansUnicode
*/
module path0;
private import mango.io.FilePath ;
private import mango.io.FileProxy ;
private import mango.io.Stdout ;
void main () {
FilePath path = new FilePath ("C:"c) ;
FileProxy proxy = new FileProxy(path ) ;
Stdout("Mango Path/Proxy Problem - Test Index 0"c)(CR);
auto hits = proxy.toList;
Stdout.println("Found ?d hits.", hits.length);
foreach (i, x; hits) {
Stdout.println(" ?d: ?s", i, x.toString);
}
}
|
Is this a known bug with a workaround? Or maybe a strange fluke error that only happens with -version=Win32SansUnicode -- I haven't had a chance yet to test without it. Or... what? _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu May 04, 2006 5:05 pm Post subject: |
|
|
Hmm. thanks Chris; I'll check it out ... |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Thu May 04, 2006 5:51 pm Post subject: |
|
|
Well I'll be darned.... I just tracked it down. And here's the teensy culprit. In the module mango.io.FileProxy line 479 is:
Code: |
fp = new FilePath ((fileinfo.cFileName [0 .. len]));
|
What it should be is:
Code: |
fp = new FilePath ((fileinfo.cFileName [0 .. len]).dup);
|
Heh. The Unicode enabled version makes it through with no problem, because the slice is first processed by Unicode.toUtf8() before going to the FilePath constructor, inadvertantly getting protected.
How about that. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu May 04, 2006 6:55 pm Post subject: |
|
|
Ach ... in *that* section
Checked-in. Thank you! |
|
Back to top |
|
|
|