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 |
} |