diff options
Diffstat (limited to 'jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy')
-rw-r--r-- | jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy b/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy index 627c9f821b99..d7e52c6d061f 100644 --- a/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy +++ b/jps/standalone-builder/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,21 +14,23 @@ * limitations under the License. */ package org.jetbrains.jps.idea + /** * @author max */ public class IdeaProjectLoader { public static String guessHome(Script script) { - File home = new File(script["gant.file"].substring("file:".length())) + String uri = script["gant.file"] + File home = new File(new URI(uri).getSchemeSpecificPart()) while (home != null) { - if (home.isDirectory()) { - if (new File(home, ".idea").exists()) return home.getCanonicalPath() + if (home.isDirectory() && new File(home, ".idea").exists()) { + return home.getCanonicalPath() } home = home.getParentFile() } - return null + throw new IllegalArgumentException("Cannot guess project home from '" + uri + "'") } } |