mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
...via jps-build-script-dependencies-bootstrap library. It was deleted in d63b2fa6bb by mistake. GitOrigin-RevId: 50beb93ddf812f60f363560318c3e7e3e2f4ef3a
37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
package org.jetbrains.jps.idea;
|
|
|
|
import groovy.lang.Script;
|
|
import org.jetbrains.jps.model.serialization.PathMacroUtil;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.net.URI;
|
|
import java.net.URISyntaxException;
|
|
|
|
/**
|
|
* @author max
|
|
*/
|
|
public class IdeaProjectLoader {
|
|
/**
|
|
* This method is still used in some *.gant scripts via jps-build-script-dependencies-bootstrap library
|
|
*/
|
|
@SuppressWarnings("unused")
|
|
public static String guessHome(Script script) throws IOException, URISyntaxException {
|
|
String uri = (String)script.getProperty("gant.file");
|
|
File home = new File(new URI(uri).getSchemeSpecificPart());
|
|
|
|
while (home != null) {
|
|
if (home.isDirectory() && new File(home, PathMacroUtil.DIRECTORY_STORE_NAME).exists()) {
|
|
return home.getCanonicalPath();
|
|
}
|
|
|
|
|
|
home = home.getParentFile();
|
|
}
|
|
|
|
|
|
throw new IllegalArgumentException("Cannot guess project home from '" + uri + "'");
|
|
}
|
|
}
|