Is there a Java utility which will convert a String path to use the correct File separator char?

后端 未结 10 2017
走了就别回头了
走了就别回头了 2020-12-09 08:54

I have developed a number of classes which manipulate files in Java. I am working on a Linux box, and have been blissfully typing new File(\"path/to/some/file\");

10条回答
  •  时光说笑
    2020-12-09 09:10

    Do you have the option of using

    System.getProperty("file.separator")
    

    to build the string that represents the path?

提交回复
热议问题