do not allow to set paths containing onedrive
This commit is contained in:
@@ -72,6 +72,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
|||||||
private bool _isDirectoryWritable = false;
|
private bool _isDirectoryWritable = false;
|
||||||
|
|
||||||
private bool _isPenumbraDirectory = false;
|
private bool _isPenumbraDirectory = false;
|
||||||
|
private bool _isOneDrive = false;
|
||||||
|
|
||||||
private bool _penumbraExists = false;
|
private bool _penumbraExists = false;
|
||||||
|
|
||||||
@@ -601,6 +602,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
|
||||||
|
_isOneDrive = path.Contains("onedrive", StringComparison.OrdinalIgnoreCase);
|
||||||
_isPenumbraDirectory = string.Equals(path.ToLowerInvariant(), _ipcManager.PenumbraModDirectory?.ToLowerInvariant(), StringComparison.Ordinal);
|
_isPenumbraDirectory = string.Equals(path.ToLowerInvariant(), _ipcManager.PenumbraModDirectory?.ToLowerInvariant(), StringComparison.Ordinal);
|
||||||
_isDirectoryWritable = IsDirectoryWritable(path);
|
_isDirectoryWritable = IsDirectoryWritable(path);
|
||||||
_cacheDirectoryHasOtherFilesThanCache = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Any(f => Path.GetFileNameWithoutExtension(f).Length != 40);
|
_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)
|
&& Directory.Exists(path)
|
||||||
&& _isDirectoryWritable
|
&& _isDirectoryWritable
|
||||||
&& !_isPenumbraDirectory
|
&& !_isPenumbraDirectory
|
||||||
|
&& !_isOneDrive
|
||||||
&& !_cacheDirectoryHasOtherFilesThanCache
|
&& !_cacheDirectoryHasOtherFilesThanCache
|
||||||
&& _cacheDirectoryIsValidPath)
|
&& _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);
|
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)
|
else if (!_isDirectoryWritable)
|
||||||
{
|
{
|
||||||
ColorTextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.", ImGuiColors.DalamudRed);
|
ColorTextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.", ImGuiColors.DalamudRed);
|
||||||
|
|||||||
Reference in New Issue
Block a user