Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
Add prompt for opening location + update message (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjw24 committed Apr 8, 2020
1 parent 7e26689 commit 9937dbb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Wox.Core/Configuration/Portable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,27 @@ public void PreStartCleanUpAfterPortabilityUpdate()

if (DataLocationRoamingDeleteRequired)
{
if(roamingDataPath.LocationExists())
MessageBox.Show("Wox detected you restarted after enabling portable mode, " +
"your roaming data profile will now be deleted");

FilesFolders.RemoveFolderIfExists(roamingDataPath);

if (MessageBox.Show("Wox has detected you enabled portable mode, " +
"would you like to move it to a different location?", string.Empty,
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
FilesFolders.OpenLocationInExporer(Constant.RootDirectory);

Environment.Exit(0);
}

return;
}

if(DataLocationPortableDeleteRequired)
{
MessageBox.Show("Wox detected you restarted after disabling portable mode, " +
"your portable data profile will now be deleted");

FilesFolders.RemoveFolderIfExists(portableDataPath);

MessageBox.Show("Wox has detected you disabled portable mode, " +
"the relevant shortcuts and uninstaller entry have been created");

return;
}
}
Expand Down
18 changes: 18 additions & 0 deletions Wox.Plugin/SharedCommands/FilesFolders.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Windows;

Expand Down Expand Up @@ -107,5 +108,22 @@ public static bool FileExits(this string filePath)
{
return File.Exists(filePath);
}

public static void OpenLocationInExporer(string location)
{
try
{
if (LocationExists(location))
Process.Start(location);
}
catch (Exception e)
{
#if DEBUG
throw e;
#else
MessageBox.Show(string.Format("Unable to open location {0}, please check if it exists", location));
#endif
}
}
}
}

0 comments on commit 9937dbb

Please sign in to comment.