原路径:
Windows: D:\Users\beyond
Linux: /home/xh/Videos
转换后路径:
Windows: D:\\Users\\beyond
Linux: /home/xh/Videos
或:
Windows: D:/Users/beyond
Linux: /home/xh/Videos
解决方法:
1. 直接换成/ ;
2. System.getProperty(“file.separator”)
本文介绍了如何在Windows和Linux系统中进行文件路径的转换方法。主要内容包括直接替换斜杠符号以及使用系统属性获取合适的路径分隔符。
原路径:
Windows: D:\Users\beyond
Linux: /home/xh/Videos
转换后路径:
Windows: D:\\Users\\beyond
Linux: /home/xh/Videos
或:
Windows: D:/Users/beyond
Linux: /home/xh/Videos
解决方法:
1. 直接换成/ ;
2. System.getProperty(“file.separator”)
443

被折叠的 条评论
为什么被折叠?