8004789: (zipfs) zip provider doesn't work correctly with file systems providers rather than the default
To use Files.createTempFile(...) to create the temp file on the same fs as the targeted path. Reviewed-by: alanb, sherman
This commit is contained in:
parent
2548b20c9e
commit
c6619c912d
@ -1085,13 +1085,13 @@ public class ZipFileSystem extends FileSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new empty temporary file in the same directory as the
|
// Creates a new empty temporary file in the same directory as the
|
||||||
// specified file. A variant of File.createTempFile.
|
// specified file. A variant of Files.createTempFile.
|
||||||
private Path createTempFileInSameDirectoryAs(Path path)
|
private Path createTempFileInSameDirectoryAs(Path path)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Path parent = path.toAbsolutePath().getParent();
|
Path parent = path.toAbsolutePath().getParent();
|
||||||
String dir = (parent == null)? "." : parent.toString();
|
Path dir = (parent == null) ? path.getFileSystem().getPath(".") : parent;
|
||||||
Path tmpPath = File.createTempFile("zipfstmp", null, new File(dir)).toPath();
|
Path tmpPath = Files.createTempFile(dir, "zipfstmp", null);
|
||||||
tmppaths.add(tmpPath);
|
tmppaths.add(tmpPath);
|
||||||
return tmpPath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user