mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add validation prior to update portability
This commit is contained in:
parent
930ceef55c
commit
82a24c9952
3 changed files with 22 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
namespace Wox.Core.Configuration
|
||||
{
|
||||
public interface IPortable
|
||||
|
|
@ -12,6 +12,6 @@ namespace Wox.Core.Configuration
|
|||
bool IsPortableModeEnabled();
|
||||
void MoveUserDataFolder(string fromLocation, string toLocation);
|
||||
void VerifyUserDataAfterMove(string fromLocation, string toLocation);
|
||||
void CleanUpFolderAfterPortabilityUpdate();
|
||||
bool CanUpdatePortability();
|
||||
}
|
||||
}
|
||||
|
|
@ -171,5 +171,22 @@ namespace Wox.Core.Configuration
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanUpdatePortability()
|
||||
{
|
||||
var roamingLocationExists = DataLocation.RoamingDataPath.LocationExists();
|
||||
var portableLocationExists = DataLocation.PortableDataPath.LocationExists();
|
||||
|
||||
if(roamingLocationExists && portableLocationExists)
|
||||
{
|
||||
MessageBox.Show(string.Format("Wox detected your user data exists both in {0} and " +
|
||||
"{1}. {2}{2}Please delete {1} in order to proceed. No changes have occured.",
|
||||
DataLocation.PortableDataPath, DataLocation.RoamingDataPath, Environment.NewLine));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ namespace Wox.ViewModel
|
|||
get { return _portableMode; }
|
||||
set
|
||||
{
|
||||
if (!_portable.CanUpdatePortability())
|
||||
return;
|
||||
|
||||
_portableMode = value;
|
||||
|
||||
Settings.PortableMode = value;
|
||||
|
|
|
|||
Loading…
Reference in a new issue