{"record":{"id":"43cbc570f60de05c","repo":"babalae/better-genshin-impact","slug":"projectpath","errorCode":null,"errorMessage":"脚本文件夹不存在:{ProjectPath}","messagePattern":"脚本文件夹不存在:(.+?)","errorType":"exception","errorClass":"DirectoryNotFoundException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Core/Script/Project/ScriptProject.cs","lineNumber":35,"sourceCode":"\nnamespace BetterGenshinImpact.Core.Script.Project;\n\npublic class ScriptProject\n{\n    public string ProjectPath { get; set; }\n    public string ManifestFile { get; set; }\n\n    public Manifest Manifest { get; set; }\n\n    public string FolderName { get; set; }\n\n    public ScriptProject(string folderName)\n    {\n        FolderName = folderName;\n        ProjectPath = Path.Combine(Global.ScriptPath(), folderName);\n        if (!Directory.Exists(ProjectPath))\n        {\n            throw new DirectoryNotFoundException(\"脚本文件夹不存在:\" + ProjectPath);\n        }\n\n        ManifestFile = Path.GetFullPath(Path.Combine(ProjectPath, \"manifest.json\"));\n        if (!File.Exists(ManifestFile))\n        {\n            throw new FileNotFoundException(\"manifest.json文件不存在，请确认此脚本是JS脚本类型。\" + ManifestFile);\n        }\n\n        Manifest = Manifest.FromJson(File.ReadAllText(ManifestFile));\n        Manifest.Validate(ProjectPath);\n    }\n\n    public ScrollViewer? LoadSettingUi(dynamic context)\n    {\n        var settingItems = Manifest.LoadSettingItems(ProjectPath);\n        if (settingItems.Count == 0)\n        {\n            return null;","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Core/Script/Project/ScriptProject.cs#L17-L53","documentation":"Thrown by the ScriptProject constructor when the project directory at Path.Combine(Global.ScriptPath(), folderName) does not exist. This is a DirectoryNotFoundException — the script folder referenced by FolderName is not present in the scripts directory. This is the first check in the constructor, before manifest loading.","triggerScenarios":"Constructing new ScriptProject(folderName) where the directory Global.ScriptPath()/folderName does not exist on disk. Called from ScriptGroupProject.BuildScriptProjectRelation when FolderName is set.","commonSituations":"A script group configuration references a folder name that was deleted, renamed, or never downloaded. The folder name in config doesn't match the actual folder on disk (typo, case mismatch). Scripts directory was moved or cleared.","solutions":["Verify the folder exists under the scripts directory: check the path in the error message.","Ensure the FolderName in the ScriptGroupProject matches the actual folder name exactly (including case).","Re-download or reinstall the script package if the folder is missing.","Remove the orphaned ScriptGroupProject entry from the configuration if the script is no longer needed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"string projectPath = Path.Combine(Global.ScriptPath(), folderName);\nif (!Directory.Exists(projectPath))\n    throw new DirectoryNotFoundException($\"Script folder not found: {projectPath}\");","typeGuard":"static bool IsScriptFolderValid(string folderName)\n{\n    var path = Path.Combine(Global.ScriptPath(), folderName);\n    return Directory.Exists(path);\n}","tryCatchPattern":"try\n{\n    var project = new ScriptProject(folderName);\n}\ncatch (DirectoryNotFoundException ex)\n{\n    TaskControl.Logger.LogError(\"Script folder missing: {Message}\", ex.Message);\n    // Skip or prompt user to reinstall\n}","preventionTips":["Verify script folders exist before constructing ScriptProject.","Keep FolderName in configuration consistent with actual folder names.","Handle orphaned configuration entries gracefully."],"tags":["script-project","directory-not-found","initialization","configuration"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}