do not allow to set paths containing onedrive

This commit is contained in:
rootdarkarchon
2024-02-22 02:10:06 +01:00
parent 07aa0d821c
commit 4e715c8eb3

View File

@@ -68,6 +68,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
private bool _isDirectoryWritable = false;
private bool _isPenumbraDirectory = false;
private bool _isOneDrive = false;
private bool _penumbraExists = false;
@@ -567,6 +568,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);
@@ -576,6 +578,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
&& Directory.Exists(path)
&& _isDirectoryWritable
&& !_isPenumbraDirectory
&& !_isOneDrive
&& !_cacheDirectoryHasOtherFilesThanCache
&& _cacheDirectoryIsValidPath)
{
@@ -596,6 +599,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);