diff --git a/MediaBrowser.Server.Implementations/Sqlite/SQLiteItemRepository.cs b/MediaBrowser.Server.Implementations/Sqlite/SQLiteItemRepository.cs index bead1360b0..a068b7cccc 100644 --- a/MediaBrowser.Server.Implementations/Sqlite/SQLiteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Sqlite/SQLiteItemRepository.cs @@ -67,6 +67,8 @@ namespace MediaBrowser.Server.Implementations.Sqlite /// private SQLiteCommand _saveChildrenCommand; + private string _criticReviewsPath; + /// /// Initializes a new instance of the class. /// @@ -88,6 +90,8 @@ namespace MediaBrowser.Server.Implementations.Sqlite _appPaths = appPaths; _jsonSerializer = jsonSerializer; + + _criticReviewsPath = Path.Combine(_appPaths.DataPath, "critic-reviews"); } /// @@ -468,23 +472,6 @@ namespace MediaBrowser.Server.Implementations.Sqlite } } - /// - /// Gets the critic reviews path. - /// - /// if set to true [create]. - /// System.String. - private string GetCriticReviewsPath(bool create) - { - var path = Path.Combine(_appPaths.DataPath, "critic-reviews"); - - if (create && !Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - return path; - } - /// /// Gets the critic reviews. /// @@ -497,7 +484,7 @@ namespace MediaBrowser.Server.Implementations.Sqlite try { - var path = Path.Combine(GetCriticReviewsPath(false), itemId + ".json"); + var path = Path.Combine(_criticReviewsPath, itemId + ".json"); return _jsonSerializer.DeserializeFromFile>(path); } @@ -523,7 +510,12 @@ namespace MediaBrowser.Server.Implementations.Sqlite { return Task.Run(() => { - var path = Path.Combine(GetCriticReviewsPath(true), itemId + ".json"); + if (!Directory.Exists(_criticReviewsPath)) + { + Directory.CreateDirectory(_criticReviewsPath); + } + + var path = Path.Combine(_criticReviewsPath, itemId + ".json"); _jsonSerializer.SerializeToFile(criticReviews.ToList(), path); });