jtulach commented on code in PR #9820:
URL: https://github.com/apache/netbeans/pull/9820#discussion_r4659685861
##########
platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java:
##########
@@ -837,12 +837,22 @@ public static File toFile(FileObject fo) {
* If not possible then null is returned.
* This is the inverse operation of {@link #toFileObject}.
* @param fo FileObject whose corresponding Path will be looked for
- * @return java.nio.file.Path or null if no corresponding File exists.
+ * @return java.nio.file.Path for the FileObject
* @since 9.32
*/
public static Path toPath(FileObject fo) {
+ Parameters.notNull("fo", fo);
File f = toFile(fo);
- return f != null ? f.toPath() : null;
+ if (f != null) {
+ return f.toPath();
+ }
+ try {
+ org.openide.filesystems.FileSystem fs = fo.getFileSystem();
+ NioFsForFileSystem nioFs = new NioFsForFileSystem(fs);
Review Comment:
- since 5018133bac51c3c459377286a6fc7701309d777a there is a single
NioFsForFileSystem per org.openide.filesystems.FileSystem
- it is lazily initialized, but there is 1:1 mapping kept
- more tests added in 5a06037844 including `relativize`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists