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

(-)a/php.nette2/src/org/netbeans/modules/php/nette2/Nette2FrameworkProvider.java (-2 / +34 lines)
Lines 42-52 Link Here
42
package org.netbeans.modules.php.nette2;
42
package org.netbeans.modules.php.nette2;
43
43
44
import java.io.File;
44
import java.io.File;
45
import java.io.IOException;
46
import java.nio.file.Files;
47
import java.nio.file.LinkOption;
48
import java.nio.file.Path;
45
import java.util.ArrayList;
49
import java.util.ArrayList;
46
import java.util.Arrays;
50
import java.util.Arrays;
47
import java.util.Collections;
51
import java.util.Collections;
48
import java.util.List;
52
import java.util.List;
49
import java.util.Set;
53
import java.util.Set;
54
import java.util.logging.Level;
55
import java.util.logging.Logger;
50
import org.netbeans.modules.php.api.framework.BadgeIcon;
56
import org.netbeans.modules.php.api.framework.BadgeIcon;
51
import org.netbeans.modules.php.api.phpmodule.PhpModule;
57
import org.netbeans.modules.php.api.phpmodule.PhpModule;
52
import org.netbeans.modules.php.api.phpmodule.PhpModuleProperties;
58
import org.netbeans.modules.php.api.phpmodule.PhpModuleProperties;
Lines 97-105 Link Here
97
        if (!result) {
103
        if (!result) {
98
            FileObject sourceDirectory = phpModule.getSourceDirectory();
104
            FileObject sourceDirectory = phpModule.getSourceDirectory();
99
            if (sourceDirectory != null) {
105
            if (sourceDirectory != null) {
100
                FileObject bootstrap = sourceDirectory.getFileObject(Constants.COMMON_BOOTSTRAP_PATH);
106
                FileObject bootstrap = getFileObject(sourceDirectory, Constants.COMMON_BOOTSTRAP_PATH);
101
                result = bootstrap != null && !bootstrap.isFolder() && bootstrap.isValid();
107
                result = bootstrap != null && !bootstrap.isFolder() && bootstrap.isValid();
102
                FileObject config = sourceDirectory.getFileObject(Constants.COMMON_CONFIG_PATH);
108
                FileObject config = getFileObject(sourceDirectory, Constants.COMMON_CONFIG_PATH);
103
                result = result && config != null && config.isFolder() && config.isValid();
109
                result = result && config != null && config.isFolder() && config.isValid();
104
            }
110
            }
105
        }
111
        }
Lines 181-184 Link Here
181
        return new Nette2CustomizerExtender(phpModule);
187
        return new Nette2CustomizerExtender(phpModule);
182
    }
188
    }
183
189
190
    /**
191
     * Try to get a FileObject with correct filename case. See bug 238679.
192
     *
193
     * @param parent Parent FileObject.
194
     * @param relPath Relative path, separated by slashes.
195
     */
196
    private FileObject getFileObject(FileObject parent, String relPath) {
197
        File parentFile = FileUtil.toFile(parent);
198
        if (parentFile != null) {
199
            String nativePath = relPath.replace('/', File.separatorChar);
200
            try {
201
                Path filePath = parentFile.toPath().resolve(nativePath);
202
                if (!Files.exists(filePath)) {
203
                    return null;
204
                }
205
                Path realPath = filePath.toRealPath(LinkOption.NOFOLLOW_LINKS);
206
                return FileUtil.toFileObject(realPath.toFile());
207
            } catch (IOException ex) {
208
                Logger.getLogger(Nette2FrameworkProvider.class.getName()).log(
209
                        Level.FINE, null, ex);
210
                return null;
211
            }
212
        } else {
213
            return null;
214
        }
215
    }
184
}
216
}
(-)a/php.symfony2/src/org/netbeans/modules/php/symfony2/commands/Symfony2Script.java (-1 / +19 lines)
Lines 47-52 Link Here
47
import java.io.IOException;
47
import java.io.IOException;
48
import java.io.InputStreamReader;
48
import java.io.InputStreamReader;
49
import java.io.Reader;
49
import java.io.Reader;
50
import java.nio.file.Files;
51
import java.nio.file.LinkOption;
52
import java.nio.file.Path;
50
import java.util.ArrayList;
53
import java.util.ArrayList;
51
import java.util.Arrays;
54
import java.util.Arrays;
52
import java.util.Collections;
55
import java.util.Collections;
Lines 117-123 Link Here
117
            // perhaps deleted app dir? fallback to default and let it fail later...
120
            // perhaps deleted app dir? fallback to default and let it fail later...
118
            return null;
121
            return null;
119
        }
122
        }
120
        return appDir.getFileObject(SCRIPT_NAME);
123
        File appDirFile = FileUtil.toFile(appDir); // #238679
124
        if (appDirFile != null) {
125
            try {
126
                Path filePath = appDirFile.toPath().resolve(SCRIPT_NAME);
127
                if (!Files.exists(filePath)) {
128
                    return null;
129
                }
130
                Path realPath = filePath.toRealPath(LinkOption.NOFOLLOW_LINKS);
131
                return FileUtil.toFileObject(realPath.toFile());
132
            } catch (IOException ex) {
133
                LOGGER.log(Level.FINE, null, ex);
134
                return null;
135
            }
136
        } else {
137
            return null;
138
        }
121
    }
139
    }
122
140
123
    /**
141
    /**

Return to bug 238679