public static string ChangeRoot(string file, string oldRootDir, string newRootDir = null) { if (oldRootDir != null) { oldRootDir = StringTools.PathFltr(oldRootDir + '\\'); if (StringTools.StartsWith(file, oldRootDir, true) == false) { throw new Exception("Wrong oldRootDir: " + oldRootDir + ", " + file); } file = file.Substring(oldRootDir.Length); } if (newRootDir != null) { file = StringTools.Combine(newRootDir, file); } return(file); }
public static void DeleteSubDirsUnhandled(string dir, string[] subDirs) { foreach (string subDir in subDirs) { string delDir = "$del_" + Guid.NewGuid().ToString("B"); { ProcessStartInfo psi = new ProcessStartInfo(); psi.WorkingDirectory = dir; psi.FileName = "cmd.exe"; psi.Arguments = "/C ren \"" + Path.GetFileName(subDir) + "\" " + delDir; psi.CreateNoWindow = true; psi.UseShellExecute = false; Process.Start(psi).WaitForExit(); } Directory.Delete(StringTools.Combine(dir, delDir)); } }
public static string MakeTempPath() { return(StringTools.Combine(Environment.GetEnvironmentVariable("TMP"), Guid.NewGuid().ToString("B"))); }
public static string GetTempPath(string relPath) { return(StringTools.Combine(Environment.GetEnvironmentVariable("TMP"), relPath)); }
public string MakePath() { return(StringTools.Combine(_rootDir, Guid.NewGuid().ToString("B"))); }
public string GetPath(string relPath) { return(StringTools.Combine(_rootDir, relPath)); }