{"record":{"id":"86d1d5409d71dcfb","repo":"EllanJiang/GameFramework","slug":"read-write-path-is-invalid","errorCode":null,"errorMessage":"Read-write path is invalid.","messagePattern":"Read-write path is invalid\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"critical","filePath":"GameFramework/Resource/ResourceManager.ResourceChecker.cs","lineNumber":78,"sourceCode":"            /// 检查资源。\n            /// </summary>\n            /// <param name=\"currentVariant\">当前使用的变体。</param>\n            /// <param name=\"ignoreOtherVariant\">是否忽略处理其它变体的资源，若不忽略，将会移除其它变体的资源。</param>\n            public void CheckResources(string currentVariant, bool ignoreOtherVariant)\n            {\n                if (m_ResourceManager.m_ResourceHelper == null)\n                {\n                    throw new GameFrameworkException(\"Resource helper is invalid.\");\n                }\n\n                if (string.IsNullOrEmpty(m_ResourceManager.m_ReadOnlyPath))\n                {\n                    throw new GameFrameworkException(\"Read-only path is invalid.\");\n                }\n\n                if (string.IsNullOrEmpty(m_ResourceManager.m_ReadWritePath))\n                {\n                    throw new GameFrameworkException(\"Read-write path is invalid.\");\n                }\n\n                m_CurrentVariant = currentVariant;\n                m_IgnoreOtherVariant = ignoreOtherVariant;\n                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, RemoteVersionListFileName)), new LoadBytesCallbacks(OnLoadUpdatableVersionListSuccess, OnLoadUpdatableVersionListFailure), null);\n                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadOnlyPath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadOnlyVersionListSuccess, OnLoadReadOnlyVersionListFailure), null);\n                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadWriteVersionListSuccess, OnLoadReadWriteVersionListFailure), null);\n            }\n\n            private void SetCachedFileSystemName(ResourceName resourceName, string fileSystemName)\n            {\n                GetOrAddCheckInfo(resourceName).SetCachedFileSystemName(fileSystemName);\n            }\n\n            private void SetVersionInfo(ResourceName resourceName, LoadType loadType, int length, int hashCode, int compressedLength, int compressedHashCode)\n            {\n                GetOrAddCheckInfo(resourceName).SetVersionInfo(loadType, length, hashCode, compressedLength, compressedHashCode);\n            }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceChecker.cs#L60-L96","documentation":"CheckResources also requires the read-write path (ReadWritePath, where downloaded/updated resources are stored) to be non-empty, because the remote version list is loaded from it. If m_ReadWritePath is null or empty the framework throws this GameFrameworkException.","triggerScenarios":"Calling CheckResources when resourceComponent.ReadWritePath (or ResourceManager.m_ReadWritePath) is null or string.Empty — e.g. the writable-path initialization step was skipped or assigned after CheckResources.","commonSituations":"Not setting ReadWritePath to a persistent-data location (Application.persistentDataPath) before starting a resource update; calling CheckResources from a custom manager that bypasses the component's initialization flow.","solutions":["Assign resourceComponent.ReadWritePath = Application.persistentDataPath (or equivalent writable dir) before calling CheckResources.","Ensure FileHelper/MakeSureDirectoryExists runs so the writable path is valid on the target platform.","Reorder bootstrap code so path assignment happens before CheckResources."],"exampleFix":"// before\nm_ResourceComponent.CheckResources(); // ReadWritePath not set\n\n// after\nm_ResourceComponent.ReadWritePath = Application.persistentDataPath;\nm_ResourceComponent.CheckResources();","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(m_ResourceComponent.ReadWritePath))\n    m_ResourceComponent.ReadWritePath = Application.persistentDataPath;\nif (!Directory.Exists(m_ResourceComponent.ReadWritePath))\n    Directory.CreateDirectory(m_ResourceComponent.ReadWritePath);","typeGuard":null,"tryCatchPattern":"try { m_ResourceComponent.CheckResources(); }\ncatch (GameFrameworkException ex) when (ex.Message == \"Read-write path is invalid.\")\n{\n    Debug.LogError(\"ReadWritePath not set; point it at persistent data before checking resources.\");\n}","preventionTips":["Always assign ReadWritePath = Application.persistentDataPath (or equivalent) before CheckResources.","Create the directory up front on first launch.","Keep path setup in one bootstrap function so it cannot be skipped."],"tags":["gameframework","resource","config","empty-path"],"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"}