FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FilePath/FileProxy problem.

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Thu May 04, 2006 12:25 pm    Post subject: FilePath/FileProxy problem. Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Thu May 04, 2006 5:05 pm    Post subject: Reply with quote

Hmm. thanks Chris; I'll check it out ...
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Thu May 04, 2006 5:51 pm    Post subject: Reply with quote

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. Smile
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Thu May 04, 2006 6:55 pm    Post subject: Reply with quote

Ach ... in *that* section Smile

Checked-in. Thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group