Lines 27-35
Link Here
|
27 |
import java.util.Arrays; |
27 |
import java.util.*; |
28 |
import java.util.Enumeration; |
|
|
29 |
import java.util.HashMap; |
30 |
import java.util.HashSet; |
31 |
import java.util.Iterator; |
32 |
import java.util.Map; |
33 |
import java.util.Set; |
34 |
import java.util.StringTokenizer; |
35 |
import java.util.WeakHashMap; |
36 |
-- |
Line 971
Link Here
|
|
|
963 |
} |
964 |
} else if (Utilities.getOperatingSystem() == Utilities.OS_MAC) { |
965 |
try { |
966 |
file = new File(file.toURI().normalize()).getAbsoluteFile(); |
967 |
File cannonicalFile = file.getCanonicalFile(); |
968 |
if (cannonicalFile.getAbsolutePath().equalsIgnoreCase(file.getAbsolutePath())) { |
969 |
file = cannonicalFile; |
970 |
} |
971 |
else { |
972 |
String fileName = file.getAbsolutePath(); |
973 |
final String pattern = File.separator + ".." + File.separator; //NOI18N |
974 |
int index = fileName.lastIndexOf (pattern); |
975 |
if (index>-1) { |
976 |
fileName = fileName.substring (index+pattern.length()); //Remove starting {/../}* |
977 |
} |
978 |
else { |
979 |
fileName = fileName.substring(1); //Remove starting / |
980 |
} |
981 |
File f = File.listRoots()[0]; |
982 |
StringTokenizer tk = new StringTokenizer (fileName, File.separator); |
983 |
List nameComponents = new ArrayList (); |
984 |
while (tk.hasMoreTokens()) { |
985 |
String name = tk.nextToken(); |
986 |
File newFile = new File (f, name); |
987 |
f = newFile.getCanonicalFile(); |
988 |
if (f.getAbsolutePath().equalsIgnoreCase(newFile.getAbsolutePath())) { |
989 |
nameComponents.add (f.getName()); |
990 |
} |
991 |
else { |
992 |
nameComponents.add (newFile.getName()); |
993 |
} |
994 |
} |
995 |
f = File.listRoots()[0]; |
996 |
for (Iterator it = nameComponents.iterator(); it.hasNext();) { |
997 |
String nameComponent = (String) it.next (); |
998 |
f = new File (f, nameComponent); |
999 |
} |
1000 |
file = f; |
1001 |
} |
1002 |
} catch (IOException ioe) { |
1003 |
ErrorManager.getDefault().log(ErrorManager.ERROR, "getCanonicalFile() on file "+file+" failed. "+ ioe.toString()); // NOI18N |
1004 |
// OK, so at least try to absolutize the path |
1005 |
file = file.getAbsoluteFile(); |