You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/08/27 18:52:23 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #3134: [NETBEANS-5901] Handling of FileObjects not backed by j.i.File when sorting by full path is requested.

JaroslavTulach commented on a change in pull request #3134:
URL: https://github.com/apache/netbeans/pull/3134#discussion_r697654018



##########
File path: platform/core.windows/src/org/netbeans/core/windows/model/DefaultModeModel.java
##########
@@ -232,7 +233,23 @@ public int compare(TopComponent tc1, TopComponent tc2) {
     }
 
     private int compareFullFilePath(FileObject f1, FileObject f2) {
-        return FileUtil.toFile(f1).compareTo(FileUtil.toFile(f2));
+        return toFullFilePath(f1).compareToIgnoreCase(toFullFilePath(f2));
+    }
+
+    private String toFullFilePath(FileObject fo) {
+        File f = FileUtil.toFile(fo);
+
+        if (f != null) {
+            return f.getAbsolutePath();
+        }
+
+        FileObject rootFO = FileUtil.getArchiveFile(fo);
+
+        if (rootFO != null) {
+            return toFullFilePath(rootFO) + "/" + fo.getPath();
+        }
+
+        return fo.toURL().getPath();

Review comment:
       Can't we just always compare the URL?




-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists