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 196302
Collapse All | Expand All

(-)a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/ProjectSupport.java (-1 / +7 lines)
Lines 62-67 Link Here
62
import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfigurationDescriptor;
62
import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfigurationDescriptor;
63
import org.netbeans.modules.cnd.utils.CndPathUtilitities;
63
import org.netbeans.modules.cnd.utils.CndPathUtilitities;
64
import org.netbeans.modules.cnd.utils.CndUtils;
64
import org.netbeans.modules.cnd.utils.CndUtils;
65
import org.netbeans.modules.cnd.utils.cache.CndFileUtils;
65
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
66
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
66
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
67
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
67
import org.netbeans.modules.remote.spi.FileSystemProvider;
68
import org.netbeans.modules.remote.spi.FileSystemProvider;
Lines 149-155 Link Here
149
            case REL:
150
            case REL:
150
                return CndPathUtilitities.toRelativePath(base, path);
151
                return CndPathUtilitities.toRelativePath(base, path);
151
            case ABS:
152
            case ABS:
152
                return CndPathUtilitities.toAbsolutePath(base, path);
153
                try {
154
                    return CndFileUtils.getCanonicalFileObject(path).getPath();
155
                } catch (IOException e) {
156
                    e.printStackTrace(System.err);
157
                    return path.getPath();
158
                }
153
            default:
159
            default:
154
                throw new IllegalStateException("Unexpected path mode: " + pathMode); //NOI18N
160
                throw new IllegalStateException("Unexpected path mode: " + pathMode); //NOI18N
155
        }
161
        }
(-)a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java (-2 / +11 lines)
Lines 95-104 Link Here
95
import org.netbeans.modules.cnd.utils.MIMEExtensions;
95
import org.netbeans.modules.cnd.utils.MIMEExtensions;
96
import org.netbeans.modules.cnd.utils.cache.CndFileUtils;
96
import org.netbeans.modules.cnd.utils.cache.CndFileUtils;
97
import org.netbeans.modules.cnd.utils.ui.ModalMessageDlg;
97
import org.netbeans.modules.cnd.utils.ui.ModalMessageDlg;
98
import org.netbeans.modules.remote.spi.FileSystemProvider;
98
import org.netbeans.spi.project.support.ant.AntProjectHelper;
99
import org.netbeans.spi.project.support.ant.AntProjectHelper;
99
import org.openide.DialogDisplayer;
100
import org.openide.DialogDisplayer;
100
import org.openide.NotifyDescriptor;
101
import org.openide.NotifyDescriptor;
101
import org.openide.filesystems.FileObject;
102
import org.openide.filesystems.FileObject;
103
import org.openide.filesystems.FileStateInvalidException;
104
import org.openide.filesystems.FileSystem;
102
import org.openide.filesystems.FileUtil;
105
import org.openide.filesystems.FileUtil;
103
import org.openide.util.Exceptions;
106
import org.openide.util.Exceptions;
104
import org.openide.util.ImageUtilities;
107
import org.openide.util.ImageUtilities;
Lines 133-138 Link Here
133
     * For any other project they are the same
136
     * For any other project they are the same
134
     */
137
     */
135
    private final FileObject baseDirFO;
138
    private final FileObject baseDirFO;
139
    private final FileSystem baseDirFS;
136
    private final FileObject projectDirFO;
140
    private final FileObject projectDirFO;
137
    
141
    
138
    private boolean modified = false;
142
    private boolean modified = false;
Lines 159-164 Link Here
159
        Parameters.notNull("projectDirFO", projectDirFO);
163
        Parameters.notNull("projectDirFO", projectDirFO);
160
        Parameters.notNull("baseDirFO", baseDirFO);
164
        Parameters.notNull("baseDirFO", baseDirFO);
161
        this.baseDirFO = baseDirFO;
165
        this.baseDirFO = baseDirFO;
166
        try {
167
            baseDirFS = baseDirFO.getFileSystem();
168
        } catch (FileStateInvalidException ex) {
169
            throw new IllegalStateException("Exception when getting file system for project folder object", ex); //NOI18N
170
        }
162
        this.projectDirFO = projectDirFO;
171
        this.projectDirFO = projectDirFO;
163
        rootFolder = new Folder(this, null, "root", "root", true, Folder.Kind.ROOT); // NOI18N
172
        rootFolder = new Folder(this, null, "root", "root", true, Folder.Kind.ROOT); // NOI18N
164
        projectItems = new ConcurrentHashMap<String, Item>();
173
        projectItems = new ConcurrentHashMap<String, Item>();
Lines 1105-1114 Link Here
1105
     * Don't add if root is subdir of existing root
1114
     * Don't add if root is subdir of existing root
1106
     */
1115
     */
1107
    public void addSourceRoot(String path) {
1116
    public void addSourceRoot(String path) {
1108
        String absPath = CndPathUtilitities.toAbsolutePath(getBaseDir(), path);
1117
        String absPath = CndPathUtilitities.toAbsolutePath(getBaseDirFileObject(), path);
1109
        String canonicalPath = null;
1118
        String canonicalPath = null;
1110
        try {
1119
        try {
1111
            canonicalPath = new File(absPath).getCanonicalPath();
1120
            canonicalPath = FileSystemProvider.getCanonicalPath(baseDirFS, absPath);
1112
        } catch (IOException ioe) {
1121
        } catch (IOException ioe) {
1113
            canonicalPath = null;
1122
            canonicalPath = null;
1114
        }
1123
        }
(-)a/cnd.utils/src/org/netbeans/modules/cnd/utils/CndPathUtilitities.java (-5 / +29 lines)
Lines 44-54 Link Here
44
package org.netbeans.modules.cnd.utils;
44
package org.netbeans.modules.cnd.utils;
45
45
46
import java.io.File;
46
import java.io.File;
47
import java.io.IOException;
47
import java.util.ArrayList;
48
import java.util.ArrayList;
48
import java.util.Stack;
49
import java.util.Stack;
49
import java.util.StringTokenizer;
50
import java.util.StringTokenizer;
50
import org.netbeans.modules.cnd.utils.cache.CharSequenceUtils;
51
import org.netbeans.modules.cnd.utils.cache.CharSequenceUtils;
52
import org.netbeans.modules.cnd.utils.cache.CndFileUtils;
51
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileStateInvalidException;
55
import org.openide.filesystems.FileSystem;
56
import org.openide.util.Exceptions;
52
import org.openide.util.Utilities;
57
import org.openide.util.Utilities;
53
58
54
/**
59
/**
Lines 188-198 Link Here
188
    }
193
    }
189
194
190
    public static String toAbsolutePath(FileObject base, String path) {
195
    public static String toAbsolutePath(FileObject base, String path) {
191
        return toAbsolutePath(base.getPath(), path);
196
        String newPath = path;
192
    }
197
        if (newPath == null || newPath.length() == 0) {
193
198
            newPath = "."; // NOI18N
194
    public static String toAbsolutePath(FileObject base, FileObject path) {
199
        } // NOI18N
195
        return toAbsolutePath(base, path.getPath()); // TODO: use smarter logic (compare file systems, etc)
200
        if (isPathAbsolute(newPath)) {
201
            return newPath;
202
        } else {
203
            FileObject fo = base.getFileObject(newPath);
204
            if (fo != null && fo.isValid()) {
205
                try {
206
                    return CndFileUtils.getCanonicalPath(fo);
207
                } catch (IOException ex) {
208
                    Exceptions.printStackTrace(ex);
209
                    return fo.getPath();
210
                }                        
211
            }
212
            try {
213
                FileSystem fs = base.getFileSystem();
214
                return base.getPath() + CndFileUtils.getFileSeparatorChar(fs) + path;
215
            } catch (FileStateInvalidException ex) {
216
                Exceptions.printStackTrace(ex);
217
                return base.getPath() + '/' + path;
218
            }
219
        }
196
    }
220
    }
197
221
198
    /*
222
    /*

Return to bug 196302