do not allow to set paths containing onedrive

This commit is contained in:
rootdarkarchon
2024-02-22 02:10:06 +01:00
committed by Loporrit
parent dc9a7f4363
commit 9708607db9

View File

@@ -72,6 +72,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
private bool _isDirectoryWritable = false;
private bool _isPenumbraDirectory = false;
private bool _isOneDrive = false;
private bool _penumbraExists = false;
@@ -601,6 +602,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
{
if (!success) return;
_isOneDrive = path.Contains("onedrive", StringComparison.OrdinalIgnoreCase);
_isPenumbraDirectory = string.Equals(path.ToLowerInvariant(), _ipcManager.PenumbraModDirectory?.ToLowerInvariant(), StringComparison.Ordinal);
_isDirectoryWritable = IsDirectoryWritable(path);
_cacheDirectoryHasOtherFilesThanCache = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => Path.GetFileNameWithoutExtension(f).Length != 40);
@@ -610,6 +612,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
&& Directory.Exists(path)
&& _isDirectoryWritable
&& !_isPenumbraDirectory
&& !_isOneDrive
&& !_cacheDirectoryHasOtherFilesThanCache
&& _cacheDirectoryIsValidPath)
{
@@ -625,6 +628,10 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
{
ColorTextWrapped("Do not point the storage path directly to the Penumbra directory. If necessary, make a subfolder in it.", ImGuiColors.DalamudRed);
}
else if (_isOneDrive)
{
ColorTextWrapped("Do not point the storage path to a folder in OneDrive. Do not use OneDrive folders for any Mod related functionality.", ImGuiColors.DalamudRed);
}
else if (!_isDirectoryWritable)
{
ColorTextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.", ImGuiColors.DalamudRed);