Skip to content

Commit

Permalink
FORGE-1556 Create history, export and alias files in Forge Home.
Browse files Browse the repository at this point in the history
Aesh is now configured to create the files under the Forge home
directory: ~/.forge/
  • Loading branch information
VineetReynolds committed Feb 5, 2014
1 parent 1e69508 commit cfe09a4
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
import javax.inject.Inject;

import org.jboss.aesh.console.settings.Settings;
import org.jboss.aesh.console.settings.SettingsBuilder;
import org.jboss.forge.addon.resource.FileResource;
import org.jboss.forge.addon.resource.ResourceFactory;
import org.jboss.forge.addon.ui.controller.CommandControllerFactory;
import org.jboss.forge.furnace.addons.AddonRegistry;
import org.jboss.forge.furnace.util.Assert;
import org.jboss.forge.furnace.util.OperatingSystemUtils;

/**
* Creates {@link Shell} instances
Expand Down Expand Up @@ -48,7 +50,16 @@ public Shell createShell(File initialSelection, Settings settings)
{
Assert.notNull(settings, "Settings cannot be null");
FileResource<?> initialResource = resourceFactory.create(initialSelection).reify(FileResource.class);
return new ShellImpl(initialResource, settings, commandManager, addonRegistry, commandFactory);
File forgeHome = OperatingSystemUtils.getUserForgeDir();
File history = new File(forgeHome, "history");
File alias = new File(forgeHome, "alias");
File export = new File(forgeHome, "export");
Settings newSettings = new SettingsBuilder(settings)
.historyFile(history)
.aliasFile(alias)
.setExportFile(export)
.create();
return new ShellImpl(initialResource, newSettings, commandManager, addonRegistry, commandFactory);
}

}

0 comments on commit cfe09a4

Please sign in to comment.