如何从文件夹路径创建文件路径
How to create a file Path from a folder Path
我可能忽略了一些东西,但是从文件夹 Path
创建文件 Path
的正确方法是什么?这就是我正在做的,但将文件夹路径转换为字符串只是为了重建它似乎是错误的。有没有更好的方法?
Path testFolder = Files.createTempDirectory("fileFinder");
Path testFile = Paths.get(testFolder.toString(), "sample.java");
Files.createFile(testFile);
我可能忽略了一些东西,但是从文件夹 Path
创建文件 Path
的正确方法是什么?这就是我正在做的,但将文件夹路径转换为字符串只是为了重建它似乎是错误的。有没有更好的方法?
Path testFolder = Files.createTempDirectory("fileFinder");
Path testFile = Paths.get(testFolder.toString(), "sample.java");
Files.createFile(testFile);