BeyondDimension/SteamTools · error · DirectoryNotFoundException
Source directory does not exist or could not be found: {sour
Error message
Source directory does not exist or could not be found: {sourceDir} What it means
Error "Source directory does not exist or could not be found: {sourceDir}" thrown in BeyondDimension/SteamTools.
Source
Thrown at src/BD.WTTS.Client.Tools.Publish/Commands/IGenerateBsPatch.cs:162
}
Console.WriteLine("ApplyPatch OK");
}
/// <summary>
/// 复制目录下的文件
/// </summary>
/// <param name="sourceDir"></param>
/// <param name="targetDir"></param>
/// <exception cref="DirectoryNotFoundException"></exception>
public static void CopyDirectory(string sourceDir, string targetDir)
{
DirectoryInfo dir = new DirectoryInfo(sourceDir);
DirectoryInfo[] dirs = dir.GetDirectories();
// If the source directory does not exist, throw an exception.
if (!dir.Exists)
{
throw new DirectoryNotFoundException($"Source directory does not exist or could not be found: {sourceDir}");
}
// If the destination directory does not exist, create it.
if (!Directory.Exists(targetDir))
{
Directory.CreateDirectory(targetDir);
}
// Get the files in the directory and copy them to the new location.
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string tempPath = Path.Combine(targetDir, file.Name);
file.CopyTo(tempPath, false);
}
// If copying subdirectories, copy them and their contents to the new location.
foreach (DirectoryInfo subdir in dirs)View on GitHub (pinned to c16ffa08e0)
Solutions
- Verify the source directory path is correct and the directory exists before running the publish/patch command.
- Create the missing directory or fix the path passed as sourceDir.
- If the path is built from relative segments, run the tool from the repository root so relative paths resolve correctly.
Example fix
Check the path in the exception message, then create it (e.g. mkdir <sourceDir>) or correct the --sourceDir argument and rerun the command.
When it happens
Trigger: Thrown when generating a binary delta patch (bsdiff) during publish: the source directory passed to the patch-generation command does not exist on disk, so the tool cannot enumerate its subdirectories.
Common situations: Occurs during local publish/CI runs when the build output folder was not produced, was cleaned, or a wrong relative/absolute path was supplied to the bs-patch generation step. Verify the source path exists and the preceding build step completed.
AI-assisted analysis of BeyondDimension/SteamTools@c16ffa08e0 (2026-08-13).
Data as JSON: /api/errors/2a8fdc322e9b8956.
Report an issue: GitHub.