diff --git a/MareSynchronos/MareSynchronos.csproj b/MareSynchronos/MareSynchronos.csproj index 603fb69..ef9eb63 100644 --- a/MareSynchronos/MareSynchronos.csproj +++ b/MareSynchronos/MareSynchronos.csproj @@ -3,7 +3,7 @@ - 0.0.6.0 + 0.0.7.0 https://github.com/Penumbra-Sync/client diff --git a/MareSynchronos/UI/IntroUI.cs b/MareSynchronos/UI/IntroUI.cs index dd95e92..889aac2 100644 --- a/MareSynchronos/UI/IntroUI.cs +++ b/MareSynchronos/UI/IntroUI.cs @@ -127,7 +127,7 @@ namespace MareSynchronos.UI _uiShared.DrawCacheDirectorySetting(); - if (!_fileCacheManager.IsScanRunning) + if (!_fileCacheManager.IsScanRunning && !string.IsNullOrEmpty(_pluginConfiguration.CacheFolder)) { UiShared.TextWrapped("You can adjust how many parallel threads will be used for scanning. Mind that ultimately it will depend on the amount of mods, your disk speed and your CPU. " + "More is not necessarily better, the default of 10 should be fine for most cases."); diff --git a/MareSynchronos/UI/MainUi.cs b/MareSynchronos/UI/MainUi.cs index 6dbf5b7..3eb6109 100644 --- a/MareSynchronos/UI/MainUi.cs +++ b/MareSynchronos/UI/MainUi.cs @@ -89,7 +89,8 @@ namespace MareSynchronos.UI ServerState.Disconnected => "Disconnected", ServerState.Unauthorized => "Unauthorized", ServerState.VersionMisMatch => "Service version mismatch", - ServerState.Offline => "Service unavailable" + ServerState.Offline => "Service unavailable", + ServerState.NoAccount => "No account", }; ImGui.SetWindowFontScale(1.2f); ImGui.TextColored(ImGuiColors.DalamudRed, $"No UID ({errorMsg})"); diff --git a/MareSynchronos/UI/UIShared.cs b/MareSynchronos/UI/UIShared.cs index 5629b13..e571dcb 100644 --- a/MareSynchronos/UI/UIShared.cs +++ b/MareSynchronos/UI/UIShared.cs @@ -310,11 +310,15 @@ namespace MareSynchronos.UI var cacheDirectory = _pluginConfiguration.CacheFolder; if (ImGui.InputText("Cache Folder##cache", ref cacheDirectory, 255)) { - _pluginConfiguration.CacheFolder = cacheDirectory; - if (!string.IsNullOrEmpty(_pluginConfiguration.CacheFolder) - && Directory.Exists(_pluginConfiguration.CacheFolder) - && (_isDirectoryWritable = IsDirectoryWritable(_pluginConfiguration.CacheFolder))) + _isPenumbraDirectory = cacheDirectory.ToLower() == _ipcManager.PenumbraModDirectory()?.ToLower(); + _isDirectoryWritable = IsDirectoryWritable(cacheDirectory); + + if (!string.IsNullOrEmpty(cacheDirectory) + && Directory.Exists(cacheDirectory) + && _isDirectoryWritable + && !_isPenumbraDirectory) { + _pluginConfiguration.CacheFolder = cacheDirectory; _pluginConfiguration.Save(); _fileCacheManager.StartWatchers(); } @@ -329,10 +333,11 @@ namespace MareSynchronos.UI { if (!success) return; - _pluginConfiguration.CacheFolder = path; - _isDirectoryWritable = IsDirectoryWritable(_pluginConfiguration.CacheFolder); - if (_isDirectoryWritable) + _isDirectoryWritable = IsDirectoryWritable(path); + _isPenumbraDirectory = path.ToLower() == _ipcManager.PenumbraModDirectory()?.ToLower(); + if (_isDirectoryWritable && !_isPenumbraDirectory) { + _pluginConfiguration.CacheFolder = path; _pluginConfiguration.Save(); _fileCacheManager.StartWatchers(); } @@ -340,11 +345,17 @@ namespace MareSynchronos.UI } ImGui.PopFont(); - if (!Directory.Exists(cacheDirectory) || !_isDirectoryWritable) + if (_isPenumbraDirectory) + { + ColorTextWrapped("Do not point the cache path directly to the Penumbra directory. If necessary, make a subfolder in it.", ImGuiColors.DalamudRed); + } + else if (!Directory.Exists(cacheDirectory) || !_isDirectoryWritable) { ColorTextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.", ImGuiColors.DalamudRed); } + + int maxCacheSize = _pluginConfiguration.MaxLocalCacheInGiB; if (ImGui.SliderInt("Maximum Cache Size in GB", ref maxCacheSize, 1, 50, "%d GB")) { @@ -354,6 +365,7 @@ namespace MareSynchronos.UI } private bool _isDirectoryWritable = false; + private bool _isPenumbraDirectory = false; public bool IsDirectoryWritable(string dirPath, bool throwIfFails = false) {