sid-srini commented on code in PR #9263:
URL: https://github.com/apache/netbeans/pull/9263#discussion_r3241937701


##########
ide/projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java:
##########
@@ -210,6 +210,18 @@ public Project getOwner(FileObject f) {
         return null;
     }
 
+    private static boolean notWithinProjectScanRoots(FileObject f) {
+        if (projectScanRoots == null)
+            return false;
+        String path = f.getPath();
+        for (String scanRoot : projectScanRoots) {
+            if (path.startsWith(scanRoot)
+                    && (path.length() == scanRoot.length()
+                    || path.charAt(scanRoot.length()) == '/'))

Review Comment:
   Thanks @matthiasblaesing for your review and the close attention on these 
path comparison differences.
   
   As noted in this class, in the `separatePaths` method, `projectScanRoots` 
store `FileObject.getPath()` values since `getOwner` supplies and compares with 
`FileObject.getPath()` strings. The `FileObject` instances canonicalize and 
always return `/` as the file-separator character, even on Windows.
   
   This explicitly does not match the logic in 
`GradleFiles.Searcher#notWithinProjectScanRoots` which compares with 
`File.separatorChar`, because there `GradleFiles` uses `File` instance path 
comparisons instead. Thus, `GradleFiles.Searcher#separatePaths` notes that it 
needs to store both absolute and canonical paths in `projectScanRoots`.
   
   I hope this clarifies the difference in approach.



-- 
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

Reply via email to