fixes to intro UI, main UI, don't allow folder to be set to penumbra mod folder
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.0.6.0</Version>
|
||||
<Version>0.0.7.0</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
||||
@@ -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.");
|
||||
|
||||
@@ -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})");
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user