Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mastersign committed Oct 22, 2016
2 parents a59248e + d222272 commit 19e7cb7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
4 changes: 2 additions & 2 deletions BenchManager/BenchDashboard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.13.1.0")]
[assembly: AssemblyFileVersion("0.13.1.0")]
[assembly: AssemblyVersion("0.13.2.0")]
[assembly: AssemblyFileVersion("0.13.2.0")]
33 changes: 10 additions & 23 deletions BenchManager/BenchLib/BenchEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,25 +293,14 @@ public void RegisterInUserProfile()

var version = Config.GetStringValue(PropertyKeys.Version);
var libDir = Config.GetStringValue(PropertyKeys.LibDir);
SetEnvironmentVar("BENCH_VERSION", version, false);
SetEnvironmentVar("BENCH_HOME", Config.BenchRootDir, false);
SetEnvironmentVar("BENCH_APPS", libDir, false);

var useVars = (StringTransformer)(path =>
{
path = TryUseVar(path, "BENCH_APPS", libDir);
path = TryUseVar(path, "BENCH_HOME", Config.BenchRootDir);
return path;
});
SetEnvironmentVar("BENCH_VERSION", version);
SetEnvironmentVar("BENCH_HOME", Config.BenchRootDir);
SetEnvironmentVar("BENCH_APPS", libDir);

var benchPath = new List<string>();
benchPath.AddRange(Config.GetStringListValue(PropertyKeys.CustomPath));
benchPath.AddRange(Config.Apps.EnvironmentPath);
for (var i = 0; i < benchPath.Count; i++)
{
benchPath[i] = useVars(benchPath[i]);
}
SetEnvironmentVar("BENCH_PATH", PathList(benchPath.ToArray()), true);
SetEnvironmentVar("BENCH_PATH", PathList(benchPath.ToArray()));

var paths = GetCurrentUserPaths();
if (paths.Contains("%BENCH_PATH%")) paths.Remove("%BENCH_PATH%");
Expand All @@ -321,15 +310,15 @@ public void RegisterInUserProfile()
var env = Config.Apps.Environment;
foreach (var k in env.Keys)
{
SetEnvironmentVar(k, useVars(env[k]), true);
SetEnvironmentVar(k, env[k]);
}
var customEnv = Config.GetValue(PropertyKeys.CustomEnvironment) as IDictionary<string, string>;
if (customEnv != null)
{
foreach (var k in customEnv.Keys)
{
if ("PATH".Equals(k, StringComparison.InvariantCultureIgnoreCase)) continue;
SetEnvironmentVar(k, useVars(customEnv[k]), true);
SetEnvironmentVar(k, customEnv[k]);
}
}
}
Expand Down Expand Up @@ -457,12 +446,13 @@ private static string GetUnexpandedEnvironmentVar(string name)
}
}

private static void SetEnvironmentVar(string name, string value, bool expand)
private static void SetEnvironmentVar(string name, string value, bool expand = false)
{
using (var key = Registry.CurrentUser.OpenSubKey("Environment", true))
{
key.SetValue(name, value, expand ? RegistryValueKind.ExpandString : RegistryValueKind.String);
}
NotifyWindowsAboutSettingChange();
}

private static void DeleteEnvironmentVar(string name)
Expand All @@ -479,14 +469,11 @@ private static extern IntPtr SendMessageTimeout(
IntPtr wParam, string lParam,
uint fuFlags, uint uTimeout, IntPtr lpdwResult);

private static void NotfyWindowsAboutSettingChange()
private static void NotifyWindowsAboutSettingChange()
{
IntPtr HWND_BROADCAST = new IntPtr(0xffff);
int WM_SETTINGCHANGE = 0x001A;
uint SMTO_ABORTIFHUNG = 0x0002;
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE,
IntPtr.Zero, "Environment",
SMTO_ABORTIFHUNG, 1000, IntPtr.Zero);
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, "Environment", 0, 1000, IntPtr.Zero);
}
}
}
4 changes: 2 additions & 2 deletions BenchManager/BenchLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.13.1.0")]
[assembly: AssemblyFileVersion("0.13.1.0")]
[assembly: AssemblyVersion("0.13.2.0")]
[assembly: AssemblyFileVersion("0.13.2.0")]
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ Add a link to the GitHub diff like
[Dev Changes](https://github.com/mastersign/bench/compare/master...dev),
[App Changes](https://github.com/mastersign/bench/compare/master...apps)

## [0.13.2] - 2016-10-22
[Full Changelog](https://github.com/mastersign/bench/compare/v0.13.1...v0.13.2)

### Fixed
- Switched from expanded strings to simple strings when setting
environment variables in registry.
([#82](https://github.com/mastersign/bench/issues/82))

## [0.13.1] - 2016-10-19
[Full Changelog](https://github.com/mastersign/bench/compare/v0.13.0...v0.13.1)

Expand Down
2 changes: 1 addition & 1 deletion res/bench-install.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@ECHO OFF
SET ROOT=%~dp0

SET VERSION=0.13.1
SET VERSION=0.13.2
SET TAG=v%VERSION%
SET BENCH_ZIPURL=https://github.com/mastersign/bench/releases/download/%TAG%/Bench.zip
SET BENCH_ZIPFILE=%ROOT%Bench.zip
Expand Down
2 changes: 1 addition & 1 deletion res/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.1
0.13.2

0 comments on commit 19e7cb7

Please sign in to comment.