Linux跟Windows路径问题

String fileName = windowsOrLinux();
private static String windowsOrLinux() {
        String randomFilename = "";
        if (SystemUtil.getOsInfo().isWindows()) {
            String savePathWindows = "D:/tmp/";
            if (!FileUtil.exist(savePathWindows)) {
                FileUtil.mkdir(savePathWindows);
            }
            randomFilename = savePathWindows;
        } else {
            String savePathLinux = "/tmp/";
            if (!FileUtil.exist(savePathLinux)) {
                FileUtil.mkdir(savePathLinux);
            }
            randomFilename = savePathLinux;
        }
        return randomFilename;
 <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
              <version>5.5.8</version>
  </dependency>


版权声明:本文为weixin_43618209原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。