private void MainForm_Load(object sender, EventArgs e) { TreeViewInit.TrvInit(currPath, trvDirectory.Nodes, 0, 1); timer1.Start(); DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory + "\\Python"); if (!di.Exists) { IDE_Setup(); } string pyPath1 = @"C:\Users\% UserName\AppData\Local\Programs\Python\Python36\Scripts\"; string pyPath2 = @"C:\Users\% UserName\AppData\Local\Programs\Python\Python36"; string winpyPath1 = Environment.CurrentDirectory + @"\Python\python-3.7.0.amd64"; string winpyPath2 = Environment.CurrentDirectory + @"\Python\python-3.7.0.amd64\Scripts\"; string sysPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine); string[] oldPath = sysPath.Split(';'); var newPath = new StringBuilder(); if (!(oldPath.Contains(pyPath1) && oldPath.Contains(pyPath2))) { if (!(oldPath.Contains(winpyPath1) && oldPath.Contains(winpyPath2))) { newPath.Append(winpyPath1 + ";"); newPath.Append(winpyPath2 + ";"); foreach (string ePath in oldPath) { newPath.Append(ePath + ";"); } Environment.SetEnvironmentVariable("Path", newPath.ToString(), EnvironmentVariableTarget.Machine); } } }
private void 폴더ToolStripMenuItem_Click(object sender, EventArgs e) { if (fbdMain.ShowDialog() == DialogResult.OK) { trvDirectory.Nodes.Clear(); currPath = fbdMain.SelectedPath; TreeViewInit.TrvInit(currPath, trvDirectory.Nodes, 0, 1); } }