public static Cache AddCache(string cachePath) { if (string.IsNullOrEmpty(cachePath)) { throw new ArgumentNullException("Cache path cannot be null or empty."); } bool isReadonly = false; if (cachePath.Replace('\\', '/').StartsWith(Application.streamingAssetsPath)) { isReadonly = true; } else { if (!Directory.Exists(cachePath)) { throw new ArgumentException("Cache path '" + cachePath + "' doesn't exist."); } if ((File.GetAttributes(cachePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { isReadonly = true; } } if (Caching.GetCacheByPath(cachePath).valid) { throw new InvalidOperationException("Cache with path '" + cachePath + "' has already been added."); } return(Caching.AddCache(cachePath, isReadonly)); }