{"record":{"id":"2a8fdc322e9b8956","repo":"BeyondDimension/SteamTools","slug":"source-directory-does-not-exist-or-could-not-be-fo","errorCode":null,"errorMessage":"Source directory does not exist or could not be found: {sourceDir}","messagePattern":"Source directory does not exist or could not be found: (.+?)","errorType":"exception","errorClass":"DirectoryNotFoundException","httpStatus":null,"severity":"error","filePath":"src/BD.WTTS.Client.Tools.Publish/Commands/IGenerateBsPatch.cs","lineNumber":162,"sourceCode":"        }\n        Console.WriteLine(\"ApplyPatch OK\");\n    }\n\n    /// <summary>\n    /// 复制目录下的文件\n    /// </summary>\n    /// <param name=\"sourceDir\"></param>\n    /// <param name=\"targetDir\"></param>\n    /// <exception cref=\"DirectoryNotFoundException\"></exception>\n    public static void CopyDirectory(string sourceDir, string targetDir)\n    {\n        DirectoryInfo dir = new DirectoryInfo(sourceDir);\n        DirectoryInfo[] dirs = dir.GetDirectories();\n\n        // If the source directory does not exist, throw an exception.\n        if (!dir.Exists)\n        {\n            throw new DirectoryNotFoundException($\"Source directory does not exist or could not be found: {sourceDir}\");\n        }\n\n        // If the destination directory does not exist, create it.\n        if (!Directory.Exists(targetDir))\n        {\n            Directory.CreateDirectory(targetDir);\n        }\n\n        // Get the files in the directory and copy them to the new location.\n        FileInfo[] files = dir.GetFiles();\n        foreach (FileInfo file in files)\n        {\n            string tempPath = Path.Combine(targetDir, file.Name);\n            file.CopyTo(tempPath, false);\n        }\n\n        // If copying subdirectories, copy them and their contents to the new location.\n        foreach (DirectoryInfo subdir in dirs)","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/BeyondDimension/SteamTools/blob/c16ffa08e03b192d23ada290c4969e77f9201f3d/src/BD.WTTS.Client.Tools.Publish/Commands/IGenerateBsPatch.cs#L144-L180","documentation":"Error \"Source directory does not exist or could not be found: {sourceDir}\" thrown in BeyondDimension/SteamTools.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"Check the path in the exception message, then create it (e.g. mkdir <sourceDir>) or correct the --sourceDir argument and rerun the command.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c16ffa08e03b192d23ada290c4969e77f9201f3d","analyzedAt":"2026-08-13T11:52:20.410Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}