{"record":{"id":"947487ee5232035f","repo":"EllanJiang/GameFramework","slug":"full-path-is-invalid","errorCode":null,"errorMessage":"Full path is invalid.","messagePattern":"Full path is invalid\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/FileSystem/FileSystem.cs","lineNumber":55,"sourceCode":"        private readonly Queue<int> m_FreeStringIndexes;\n        private readonly Queue<StringData> m_FreeStringDatas;\n\n        private HeaderData m_HeaderData;\n        private int m_BlockDataOffset;\n        private int m_StringDataOffset;\n        private int m_FileDataOffset;\n\n        /// <summary>\n        /// 初始化文件系统的新实例。\n        /// </summary>\n        /// <param name=\"fullPath\">文件系统完整路径。</param>\n        /// <param name=\"access\">文件系统访问方式。</param>\n        /// <param name=\"stream\">文件系统流。</param>\n        private FileSystem(string fullPath, FileSystemAccess access, FileSystemStream stream)\n        {\n            if (string.IsNullOrEmpty(fullPath))\n            {\n                throw new GameFrameworkException(\"Full path is invalid.\");\n            }\n\n            if (access == FileSystemAccess.Unspecified)\n            {\n                throw new GameFrameworkException(\"Access is invalid.\");\n            }\n\n            if (stream == null)\n            {\n                throw new GameFrameworkException(\"Stream is invalid.\");\n            }\n\n            m_FullPath = fullPath;\n            m_Access = access;\n            m_Stream = stream;\n            m_FileDatas = new Dictionary<string, int>(StringComparer.Ordinal);\n            m_BlockDatas = new List<BlockData>();\n            m_FreeBlockIndexes = new GameFrameworkMultiDictionary<int, int>();","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/FileSystem/FileSystem.cs#L37-L73","documentation":"The private FileSystem constructor requires a valid non-empty full path identifying the archive on disk. An empty or null fullPath cannot be used to open or create the archive, so GameFramework throws immediately.","triggerScenarios":"Calling FileSystem.Create or FileSystem.Open (public entry points) with null/empty fullPath, which flows into this private constructor.","commonSituations":"Path built from unset config values (e.g. missing persistent-data path) yielding empty string; concatenation where a directory segment was empty; refactoring that dropped the file name component.","solutions":["Pass a complete absolute path including the archive file name to Create/Open","Check that the config/source of the path (e.g. Application.persistentDataPath equivalent) is populated","Combine a validated directory with Path.Combine(dir, fileName) to guarantee a non-empty full path","Guard with string.IsNullOrEmpty before calling the FileSystem API"],"exampleFix":"// before\nFileSystem.Create(savePath, FileSystemAccess.Write, stream, ...); // savePath may be \"\"\n// after\nstring fullPath = System.IO.Path.Combine(dataDir, \"game.dat\");\nif (string.IsNullOrEmpty(fullPath)) throw new InvalidOperationException(\"fullPath required\");\nFileSystem.Create(fullPath, FileSystemAccess.Write, stream, ...);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(fullPath)) throw new ArgumentException(\"fullPath is required\", nameof(fullPath));\nFileSystem.Create(fullPath, access, stream, maxFileCount, maxBlockCount);","typeGuard":"bool IsValidFullPath(string p) => !string.IsNullOrEmpty(p);","tryCatchPattern":"try { var fs = FileSystem.Create(fullPath, access, stream, fc, bc); }\ncatch (GameFrameworkException ex) when (ex.Message == \"Full path is invalid.\") { Log.Error(\"Archive path not configured\"); }","preventionTips":["Build paths with Path.Combine(dataDir, fileName) to guarantee non-empty full paths","Validate path config at startup before any filesystem operation","Log the path value at the call site to catch empty-path sources quickly"],"tags":["gameframework","filesystem","path-validation"],"backgroundTag":"empty-required-field","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}