Linux和Windows文件路径

linux系统下的文件夹路径和window下的不一样,windows下就需要写成“\photos"因为java会把第一个""当成转义字符给“吃了”。但在linux下就是

“/photos”呵呵,是不是很郁闷阿。所以你的if (myFile.newFolder(path+"\photos"))

就应该写成if (myFile.newFolder(path+"/photos"))以此类推。

public static final String FILE_SEPARATOR = System.getPRoperties().getProperty("file.separator");

文件分隔符(在 UNIX 系统中是“/”),window 是""。

原文地址:https://www.cnblogs.com/sanxinglan/p/3318520.html