a/trunk/cforge/cforge/Helper.cs | b/trunk/cforge/cforge/Helper.cs | ||
---|---|---|---|
... |
... |
||
67 | } |
67 | } |
68 | } |
68 | } |
69 | 69 | ||
70 | #endregion |
70 | #endregion |
71 | 71 | ||
72 | 72 | #region SystemPath |
|
73 | 73 | ||
74 | public static void AddToSystemPath() |
||
75 | { |
||
76 | // either do it here |
||
77 | //HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path |
||
78 | // for now we try it like this: |
||
79 | |||
80 | string strPath = System.Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine); |
||
81 | string[] split = strPath.Split(new Char[] { ';' }); |
||
82 | |||
83 | String path = Path.GetDirectoryName(GetCFORGEAssemblyPath()); |
||
84 | String strNewSystemPath = strPath + ";" + path; |
||
85 | |||
86 | if (!split.Contains(path)) |
||
87 | { |
||
88 | System.Environment.SetEnvironmentVariable("Path", strNewSystemPath, EnvironmentVariableTarget.Machine); |
||
89 | } |
||
90 | |||
91 | } |
||
92 | |||
93 | #endregion |
||
94 | |||
74 | 95 | ||
75 | /// <summary> |
96 | /// <summary> |
76 | /// Function to retrieve the location of the currenty assembly (cforge.exe). |
97 | /// Function to retrieve the location of the currenty assembly (cforge.exe). |
77 | /// This should be located in the CODESYS installation subfolder "CFORGE" |
98 | /// This should be located in the CODESYS installation subfolder "CFORGE" |
78 | /// </summary> |
99 | /// </summary> |