Thanks for trying it anyway, Joel, I wasn't at an actual computer yesterday. 

Something like this works around the issue for me: 

String path = null; 
try{ 
path=new File("./").getCanonicalPath(); 
} catch (IOException handleMePlease) {} 
LocalReference lr = LocalReference.createFileReference(path); 
Directory directory = new Directory(getContext(),lr); 

You need to get the "." and ".." resolved away, which getCanonicalPath() 
does. 

I think LocalReference should do this for you when you pass a File as in 
your original example -- thoughts, Jerome, Thierry? 

Also, I think LocalReference.getTargetRef() oughta return a LocalReference 
(you'd have to cast it, but this should work). 

- Rob 


----- Original Message ----- 
From: "Joel Nelson" <[EMAIL PROTECTED]> 
To: [email protected] 
Sent: Monday, September 17, 2007 8:00:26 PM (GMT-0500) America/New_York 
Subject: Re: Bug: DirectoryResource is broken if used with relative paths 

On Mon, 17 Sep 2007 11:26:08 -0400, Rob Heittman wrote: 

> 1) 
> // Create a directory able to expose a hierarchy of files 
> Directory directory = new Directory(getContext(), 
> LocalReference.createFileReference(new File("./").getPath())); 
> 

This one is equally broken 

> 2) 
> // Create a directory able to expose a hierarchy of files 
> Directory directory = new Directory(getContext(), 
> LocalReference.createFileReference(new File("./")).getTargetRef()); 

This one doesn't compile, "The constructor Directory(Context, Reference) 
is undefined" 

Reply via email to