On Tue, Oct 21, 2008 at 04:10:00PM +0200, Lukáš Zapletal wrote:
> > S antem i mavenem pracuju celkem bezne, ale nikdy jsem tam nepotreboval
> > absolutni cestu, vzdycky jen relativni.
>
> Ale o relativni nebo absolutni ceste tu nepadlo jedine slovo. Vztahuje
> se to i na relativni:
>
> ..\adresar\soubor
>
> ja chci
>
> ../adresar/soubor
>
> i na Windows.
No a co takto na vystup z File pouzit jednoduchy String.replace?
Nestacilo by ti to?
public class FileTest {
public static void main(String[] args) {
final String fileName = "c:/DesetJezku";
System.out.println(transformFilePath(fileName));
}
private static String transformFilePath(String fileName) {
return new
File(fileName).getAbsolutePath().replace(File.separatorChar,'/');
}
}
Oto 'tapik' Buchta