This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 47758
Collapse All | Expand All

(-)src/org/openide/filesystems/FileUtil.java (-10 / +48 lines)
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 cannonicalFile = file.getCanonicalFile();
967
                if (cannonicalFile.getAbsolutePath().equalsIgnoreCase(file.getAbsolutePath())) {
968
                    file = cannonicalFile;
969
                }
970
                else {
971
                    String fileName = file.getAbsolutePath().substring(1);
972
                    File f = File.listRoots()[0];
973
                    StringTokenizer tk = new StringTokenizer (fileName, File.separator);
974
                    List nameComponents = new ArrayList ();
975
                    while (tk.hasMoreTokens()) {
976
                        String name = tk.nextToken();
977
                        if (name.equals (".")) {        //NOI18N
978
                            continue;
979
                        }
980
                        else if (name.equals("..")) {   //NOI18N
981
                            File parent = f.getParentFile();
982
                            if (parent != null) {
983
                                f = parent;
984
                                nameComponents.remove(nameComponents.size()-1);
985
                            }
986
                            continue;
987
                        }
988
                        else {
989
                            File newFile = new File (f, name);
990
                            f = newFile.getCanonicalFile();
991
                            if (f.getAbsolutePath().equalsIgnoreCase(newFile.getAbsolutePath())) {
992
                                nameComponents.add (f.getName());
993
                            }
994
                            else {
995
                                nameComponents.add (newFile.getName());
996
                            }
997
                        }
998
                    }
999
                    f = File.listRoots()[0];
1000
                    for (Iterator it = nameComponents.iterator(); it.hasNext();) {
1001
                        String nameComponent = (String) it.next ();
1002
                        f = new File (f, nameComponent);
1003
                    }
1004
                    file = f;
1005
                }
1006
            } catch (IOException ioe) {
1007
                ErrorManager.getDefault().log(ErrorManager.ERROR, "getCanonicalFile() on file "+file+" failed. "+ ioe.toString()); // NOI18N
1008
                    // OK, so at least try to absolutize the path
1009
                file = file.getAbsoluteFile();

Return to bug 47758