fix tests: search for jars in IDEA_HOME/community/lib folder

This commit is contained in:
Nikolay Chashnikov
2009-09-02 13:50:39 +04:00
parent 8987aef56a
commit 91c02feb95
4 changed files with 12 additions and 5 deletions
@@ -251,8 +251,7 @@ public class LibraryDownloader {
if (url.startsWith(LIB_SCHEMA)) {
indicator.setText2(IdeBundle.message("progress.locate.jar.text", getExpectedFileName(libraryInfo)));
final String path = url.substring(LIB_SCHEMA.length()).replace('/', File.separatorChar);
final String fullPath = PathManager.getLibPath() + File.separatorChar + path;
final File file = new File(fullPath);
final File file = PathManager.findFileInLibDirectory(path);
downloadedFiles.add(Pair.create(libraryInfo, file));
} else if (url.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) {
String path = url.substring(LocalFileSystem.PROTOCOL_PREFIX.length()).replace('/', File.separatorChar).replace('\\', File.separatorChar);
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SystemProperties;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.net.URL;
@@ -372,4 +373,12 @@ public class PathManager {
return systemPath + File.separator + PLUGINS_DIRECTORY;
}
public static File findFileInLibDirectory(@NotNull String relativePath) {
File file = new File(getLibPath() + File.separator + relativePath);
if (file.exists()) {
return file;
}
return new File(getHomePath() + File.separator + "community" + File.separator + "lib" + File.separator + relativePath);
}
}
@@ -69,8 +69,7 @@ public class GlobalAntConfiguration implements ApplicationComponent, JDOMExterna
}
};
AntInstallation.NAME.set(bundledAnt.getProperties(), BUNDLED_ANT_NAME);
final File ideaLib = new File(PathManager.getLibPath());
final File antHome = new File(ideaLib, ANT_FILE);
final File antHome = PathManager.findFileInLibDirectory(ANT_FILE);
AntInstallation.HOME_DIR.set(bundledAnt.getProperties(), antHome.getAbsolutePath());
ArrayList<AntClasspathEntry> classpath = AntInstallation.CLASS_PATH.getModifiableList(bundledAnt.getProperties());
File antLibDir = new File(antHome, LIB_DIR);
@@ -251,7 +251,7 @@ public final class PreviewFormAction extends AnAction{
// 3. Now we are ready to launch Java process
final JavaParameters parameters = new JavaParameters();
parameters.getClassPath().add(tempPath);
parameters.getClassPath().add(PathManager.getLibPath() + "/jgoodies-forms.jar");
parameters.getClassPath().add(PathManager.findFileInLibDirectory("jgoodies-forms.jar").getAbsolutePath());
final List<String> paths = sources.getPathList();
for (final String path : paths) {
parameters.getClassPath().add(path);