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:
Namhyeon Go 2025-11-16 18:58:48 +09:00 committed by GitHub
parent c392b6a08a
commit daea458f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -207,25 +207,21 @@ namespace WelsonJS.Launcher
throw; throw;
} }
return workingDirectory;
}
private static void CopyDirectoryRecursive(string sourceDir, string destDir) var sourceDirInfo = new DirectoryInfo(sourceDir);
{
if (!Directory.Exists(sourceDir))
{
throw new DirectoryNotFoundException("Source directory not found: " + sourceDir);
}
Directory.CreateDirectory(destDir); // Create all subdirectories
foreach (DirectoryInfo dir in sourceDirInfo.GetDirectories("*", SearchOption.AllDirectories))
foreach (var file in Directory.GetFiles(sourceDir, "*", SearchOption.AllDirectories)) {
{ Directory.CreateDirectory(Path.Combine(destDir, dir.FullName.Substring(sourceDirInfo.FullName.Length + 1)));
string relativePath = file.Substring(sourceDir.Length).TrimStart( }
Path.DirectorySeparatorChar,
Path.AltDirectorySeparatorChar
);
// 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 targetPath = Path.Combine(destDir, relativePath);
string targetDir = Path.GetDirectoryName(targetPath); string targetDir = Path.GetDirectoryName(targetPath);
if (!Directory.Exists(targetDir)) if (!Directory.Exists(targetDir))