没有人知道么?
我只是想知道为什么在获取存在空格的目录名的时候会出现获取的路径有问题,有谁遇到过这个问题没有??有没有什么其它的方法获取绝对路径???标题写成相对路径写错了,在此致歉:)
File f = new File(".");
String sTemp = f.getAbsolutePath();
String path = sTemp.substring(0,sTemp.length()-1);
我只是想知道为什么在获取存在空格的目录名的时候会出现获取的路径有问题,有谁遇到过这个问题没有??有没有什么其它的方法获取绝对路径???标题写成相对路径写错了,在此致歉:)
File f = new File(".");
String sTemp = f.getAbsolutePath();
String path = sTemp.substring(0,sTemp.length()-1);
try{
File f = new File("");
String sTemp = f.getAbsolutePath();
String path = sTemp.substring(0,sTemp.length());
System.out.println(path);
}
catch (NullPointerException e2) {
return;
}