File tree Expand file tree Collapse file tree
org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 *******************************************************************************/
1818package org .eclipse .jdt .internal .core ;
1919
20- import java .io .File ;
2120import java .io .FileOutputStream ;
2221import java .io .IOException ;
2322import java .nio .file .Files ;
23+ import java .nio .file .attribute .BasicFileAttributes ;
2424import java .util .ArrayList ;
2525import java .util .Collection ;
2626import java .util .Collections ;
@@ -151,12 +151,16 @@ public static boolean isExternalFolderPath(IPath externalPath) {
151151 return false ;
152152 }
153153 // Test if this an absolute path in local file system (not the workspace path)
154- File externalFolder = externalPath .toFile ();
155- if (Files .isRegularFile (externalFolder .toPath ())) {
154+ BasicFileAttributes externalAttributes = null ;
155+ try {
156+ externalAttributes = Files .readAttributes (externalPath .toPath (), BasicFileAttributes .class );
157+ } catch (IOException e ) { // assume not existing
158+ }
159+ if (externalAttributes != null && externalAttributes .isRegularFile ()) {
156160 manager .addExternalFile (externalPath , true );
157161 return false ;
158162 }
159- if (Files .isDirectory (externalFolder . toPath () )) {
163+ if (externalAttributes != null && externalAttributes .isDirectory ()) {
160164 return true ;
161165 }
162166 // this can be now only full workspace path or an external path to a not existing file or folder
You can’t perform that action at this time.
0 commit comments