Example #1
0
        public static void SetPath(string pathValue, bool before = false)
        {
            string pathList = SysEnv.GetSysEnvironmentByName("Path");

            if (string.IsNullOrEmpty(pathList))
            {
                return;
            }

            string[] list = pathList.Split(';');
            if (list.Contains(pathValue))
            {
                return;
            }

            string[] newList = new string[] { pathValue };

            if (before)
            {
                newList.Concat(list);
            }
            else
            {
                list.Concat(newList);
            }

            SetEnvironmentVariable("Path", string.Join(";", list));
        }
Example #2
0
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);

            string pathValue = $@"{Context.Parameters["rootPath"].Replace("/", "")}bin\";

            SysEnv.RemovePath(pathValue);
        }
Example #3
0
        public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);

            string pathValue = $@"{Context.Parameters["rootPath"].Replace("/", "")}bin\";

            SysEnv.SetPath(pathValue);
        }