{"record":{"id":"0f552076871f4486","repo":"EllanJiang/GameFramework","slug":"read-write-path-is-invalid-0f5520","errorCode":null,"errorMessage":"Read-write path is invalid.","messagePattern":"Read-write path is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":885,"sourceCode":"            }\n\n            if (m_ResourceLoader.TotalAgentCount > 0)\n            {\n                throw new GameFrameworkException(\"You must set read-only path before add load resource agent helper.\");\n            }\n\n            m_ReadOnlyPath = readOnlyPath;\n        }\n\n        /// <summary>\n        /// 设置资源读写区路径。\n        /// </summary>\n        /// <param name=\"readWritePath\">资源读写区路径。</param>\n        public void SetReadWritePath(string readWritePath)\n        {\n            if (string.IsNullOrEmpty(readWritePath))\n            {\n                throw new GameFrameworkException(\"Read-write path is invalid.\");\n            }\n\n            if (m_RefuseSetFlag)\n            {\n                throw new GameFrameworkException(\"You can not set read-write path at this time.\");\n            }\n\n            if (m_ResourceLoader.TotalAgentCount > 0)\n            {\n                throw new GameFrameworkException(\"You must set read-write path before add load resource agent helper.\");\n            }\n\n            m_ReadWritePath = readWritePath;\n        }\n\n        /// <summary>\n        /// 设置资源模式。\n        /// </summary>","sourceCodeStart":867,"sourceCodeEnd":903,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L867-L903","documentation":"ResourceManager.SetReadWritePath throws GameFrameworkException when the readWritePath argument is null or empty. The read-write path is where downloaded/updated resources are stored; the framework rejects invalid values immediately.","triggerScenarios":"Calling resourceComponent.SetReadWritePath(null) or resourceComponent.SetReadWritePath(\"\").","commonSituations":"The path comes from a platform-specific API or config that is empty on the current platform (e.g. missing persistent data path setup), or a typo leaving the setting blank.","solutions":["Pass a valid non-empty path, typically Unity's Application.persistentDataPath or a directory under it","Fix the config/environment source producing the empty value","Validate with string.IsNullOrEmpty before calling"],"exampleFix":"// before\nresourceComponent.SetReadWritePath(settings.SavePath); // \"\"\n// after\nresourceComponent.SetReadWritePath(Application.persistentDataPath);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(readWritePath)) readWritePath = Application.persistentDataPath;\nresourceComponent.SetReadWritePath(readWritePath);","typeGuard":"bool IsValidPath(string p) => !string.IsNullOrEmpty(p);","tryCatchPattern":"try { resourceComponent.SetReadWritePath(path); }\ncatch (GameFrameworkException ex) { Log.Error(\"SetReadWritePath failed: {0}\", ex.Message); }","preventionTips":["Default to Application.persistentDataPath when no explicit path is configured","Validate paths loaded from config before use","Test on all target platforms since persistent paths differ"],"tags":["gameframework","unity","resource","argument-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-16T04:17:20.429Z"}