mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-11-27 18:11:20 +00:00
Update WelsonJS.Toolkit/WelsonJS.Launcher/Program.cs
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
This commit is contained in:
parent
c392b6a08a
commit
daea458f64
|
|
@ -207,25 +207,21 @@ namespace WelsonJS.Launcher
|
|||
throw;
|
||||
}
|
||||
|
||||
return workingDirectory;
|
||||
}
|
||||
|
||||
private static void CopyDirectoryRecursive(string sourceDir, string destDir)
|
||||
{
|
||||
if (!Directory.Exists(sourceDir))
|
||||
{
|
||||
throw new DirectoryNotFoundException("Source directory not found: " + sourceDir);
|
||||
}
|
||||
var sourceDirInfo = new DirectoryInfo(sourceDir);
|
||||
|
||||
Directory.CreateDirectory(destDir);
|
||||
|
||||
foreach (var file in Directory.GetFiles(sourceDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
string relativePath = file.Substring(sourceDir.Length).TrimStart(
|
||||
Path.DirectorySeparatorChar,
|
||||
Path.AltDirectorySeparatorChar
|
||||
);
|
||||
// Create all subdirectories
|
||||
foreach (DirectoryInfo dir in sourceDirInfo.GetDirectories("*", SearchOption.AllDirectories))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(destDir, dir.FullName.Substring(sourceDirInfo.FullName.Length + 1)));
|
||||
}
|
||||
|
||||
// Copy all files
|
||||
foreach (FileInfo file in sourceDirInfo.GetFiles("*", SearchOption.AllDirectories))
|
||||
{
|
||||
string targetPath = Path.Combine(destDir, file.FullName.Substring(sourceDirInfo.FullName.Length + 1));
|
||||
file.CopyTo(targetPath, true);
|
||||
}
|
||||
string targetPath = Path.Combine(destDir, relativePath);
|
||||
string targetDir = Path.GetDirectoryName(targetPath);
|
||||
if (!Directory.Exists(targetDir))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user