Create HOME on windows

Change-Id: Id16278b5280e25e383e474faf4b511c47e5d0751
This commit is contained in:
Patrick Plenefisch
2014-10-08 17:15:51 -04:00
parent 0b828eec62
commit 8079482820
2 changed files with 28 additions and 1 deletions

View File

@@ -1,6 +1,12 @@
package edu.wpi.first.wpilib.plugins.cpp.installer;
import java.io.InputStream;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.IValueVariable;
import org.eclipse.core.variables.VariablesPlugin;
import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller;
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
import edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceConstants;
@@ -21,6 +27,26 @@ public class CPPInstaller extends AbstractInstaller {
protected void updateInstalledVersion(String version) {
WPILibCPPPlugin.getDefault().getPreferenceStore().setValue(PreferenceConstants.LIBRARY_INSTALLED,
version);
IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
try
{
if (System.getProperty("os.name").startsWith("Windows"))
{
IValueVariable vv = vm.getValueVariable("HOME");
if (vv == null)
vm.addVariables(new IValueVariable[]{vm.newValueVariable("HOME", "user.home directory", false,System.getProperty("user.home"))});
else
{
if (!System.getProperty("user.home").equals(vm.performStringSubstitution("${HOME}")))
vv.setValue(System.getProperty("user.home"));
}
}
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new RuntimeException(e);
}
}
@Override