commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <stei...@yahoo.com>
Subject RE: [math] stupid question about test input files
Date Thu, 15 May 2003 00:13:06 GMT
 
> 
> If you *really* need disk files, I'd suggest using a
> relative path from
> the default directory.  For example, if you had a
> "src/test/resources"
> directory in the repository, with a "foo.txt" file
> in it, the relative
> path would be:
> 
>   src/test/resources/foo.txt
> 
> and this would work no matter where the developer
> actually had the
> repository in their own workspace -- and also works
> portably across
> platforms courtesy of Java's handling of slashes for
> you.
> 
> If you need absolute paths, you can still get one of
> those as well:
> 
>   File dir = new File(".");
>   File file = new File(dir,
> "src/test/resources/foo.txt");
>   String path = file.getAbsolutePath();
> 
> without having to hard code anything.
> 
> > Phil
> 
> Craig
> 

OK. I get it now.  Given that the
ClassLoader.getResourceAsStream() method is simpler,
and I see no harm in adding APIs to work with Files, I
think that I will do that.

Thanks for your help.

Phil
 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message