Skip to content

Commit

Permalink
Added getForgeHome()
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Sep 11, 2012
1 parent 45531d5 commit 00016af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*
*/
public interface ForgeEnvironment
{
Expand Down Expand Up @@ -62,4 +62,10 @@ public interface ForgeEnvironment
* Get the current User's configuration file.
*/
FileResource<?> getUserConfiguration();

/**
* Get the Forge Home directory
* @return
*/
DirectoryResource getForgeHome();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
*
*/
@ApplicationScoped
public class ForgeEnvironmentImpl implements ForgeEnvironment
Expand Down Expand Up @@ -109,4 +109,11 @@ public FileResource<?> getUserConfiguration()
{
return getConfigDirectory().getChild("config.xml").reify(FileResource.class);
}

@Override
public DirectoryResource getForgeHome()
{
String forgeHome = System.getProperty(ShellImpl.FORGE_HOME_SYSTEM_PROPERTY);
return resourceFactory.getResourceFrom(new File(forgeHome)).reify(DirectoryResource.class);
}
}
1 change: 1 addition & 0 deletions shell/src/main/java/org/jboss/forge/shell/ShellImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public class ShellImpl extends AbstractShellPrompt implements Shell
public static final String PROP_EXCEPTION_HANDLING = "EXCEPTION_HANDLING";
public static final String PROP_FORGE_VERSION = "FORGE_VERSION";
static final String NO_INIT_SYSTEM_PROPERTY = "forge.debug.no_auto_init_streams";
static final String FORGE_HOME_SYSTEM_PROPERTY = "forge.home";

static final String PROP_IGNORE_EOF = "IGNOREEOF";
static final int DEFAULT_IGNORE_EOF = 1;
Expand Down

0 comments on commit 00016af

Please sign in to comment.