LinkSlnHelper.cs 953 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using UnityEditor;
  6. namespace ET
  7. {
  8. public static class LinkSlnHelper
  9. {
  10. //[MenuItem("ET/Init/LinkSln")]
  11. public static void Run()
  12. {
  13. string etslnPath = Path.Combine(Directory.GetCurrentDirectory(), "ET.sln");
  14. if (File.Exists(etslnPath))
  15. {
  16. File.Delete(etslnPath);
  17. }
  18. List<string> slns = new List<string>();
  19. FileHelper.GetAllFiles(slns, "./Packages", "ET.sln");
  20. if (slns.Count == 0)
  21. {
  22. throw new Exception("not found ET.sln in et packages!");
  23. }
  24. Process process = ProcessHelper.PowerShell($"-c New-Item -ItemType HardLink -Target {slns[0]} ./ET.sln", waitExit: true);
  25. UnityEngine.Debug.Log(process.StandardOutput.ReadToEnd());
  26. }
  27. }
  28. }