Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/// <summary>
/// Copies the folder and all of its files and folders
/// including subfolders to the target location

Check warning on line 20 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`subfolders` is not a recognized word. (unrecognized-spelling)
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="targetPath"></param>
Expand Down Expand Up @@ -47,15 +47,15 @@
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string temppath = Path.Combine(targetPath, file.Name);

Check warning on line 50 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`temppath` is not a recognized word. (unrecognized-spelling)
file.CopyTo(temppath, false);

Check warning on line 51 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`temppath` is not a recognized word. (unrecognized-spelling)

Check warning on line 51 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`temppath` is not a recognized word. (unrecognized-spelling)
}

// Recursively copy subdirectories by calling itself on each subdirectory until there are no more to copy
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(targetPath, subdir.Name);

Check warning on line 57 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`temppath` is not a recognized word. (unrecognized-spelling)

Check warning on line 57 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`temppath` is not a recognized word. (unrecognized-spelling)
CopyAll(subdir.FullName, temppath, messageBoxExShow);

Check warning on line 58 in Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`temppath` is not a recognized word. (unrecognized-spelling)
}
}
catch (Exception)
Expand Down Expand Up @@ -150,6 +150,16 @@
return File.Exists(filePath);
}

/// <summary>
/// Checks if a file or directory exists
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static bool FileOrLocationExists(this string path)
{
return LocationExists(path) || FileExists(path);
}

/// <summary>
/// Open a directory window (using the OS's default handler, usually explorer)
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<system:String x:Key="restartToDisablePortableMode">Flow Launcher needs to restart to finish disabling portable mode, after the restart your portable data profile will be deleted and roaming data profile kept</system:String>
<system:String x:Key="restartToEnablePortableMode">Flow Launcher needs to restart to finish enabling portable mode, after the restart your roaming data profile will be deleted and portable data profile kept</system:String>
<system:String x:Key="moveToDifferentLocation">Flow Launcher has detected you enabled portable mode, would you like to move it to a different location?</system:String>
<system:String x:Key="shortcutsUninstallerCreated">Flow Launcher has detected you disabled portable mode, the relevant shortcuts and uninstaller entry have been created</system:String>

Check warning on line 25 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`uninstaller` is not a recognized word. (unrecognized-spelling)
<system:String x:Key="userDataDuplicated">Flow Launcher detected your user data exists both in {0} and {1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred.</system:String>

<!-- Plugin Loader -->
Expand Down Expand Up @@ -590,6 +590,7 @@
<system:String x:Key="errorTitle">Error</system:String>
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
<system:String x:Key="browserOpenError">An error occurred while opening the URL in the browser. Please check your Default Web Browser configuration in the General section of the settings window</system:String>
<system:String x:Key="fileNotFoundError">File or directory not found: {0}</system:String>

<!-- General Notice -->
<system:String x:Key="pleaseWait">Please wait...</system:String>
Expand Down
35 changes: 23 additions & 12 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
Expand Down Expand Up @@ -74,7 +74,6 @@ public void ChangeQuery(string query, bool requery = false)
_mainVM.ChangeQueryText(query, requery);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]
public void RestartApp()
{
_mainVM.Hide();
Expand Down Expand Up @@ -179,7 +178,7 @@ public async void CopyToClipboard(string stringToCopy, bool directCopy = false,

Clipboard.SetFileDropList(paths);
});

if (exception == null)
{
if (showDefaultNotification)
Expand Down Expand Up @@ -218,7 +217,7 @@ public async void CopyToClipboard(string stringToCopy, bool directCopy = false,
{
LogException(nameof(PublicAPIInstance), "Failed to copy text to clipboard", exception);
ShowMsgError(GetTranslation("failedToCopy"));
}
}
}
}

Expand Down Expand Up @@ -327,7 +326,7 @@ public void SavePluginSettings()

((PluginJsonStorage<T>)_pluginJsonStorages[type]).Save();
}

public void OpenDirectory(string directoryPath, string fileNameOrFilePath = null)
{
try
Expand Down Expand Up @@ -412,6 +411,12 @@ public void OpenDirectory(string directoryPath, string fileNameOrFilePath = null

private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrowser = false)
{
if (uri.IsFile && !FilesFolders.FileOrLocationExists(uri.LocalPath))
{
ShowMsgError(GetTranslation("errorTitle"), string.Format(GetTranslation("fileNotFoundError"), uri.LocalPath));
return;
}

if (forceBrowser || uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
{
var browserInfo = _settings.CustomBrowser;
Expand Down Expand Up @@ -441,13 +446,19 @@ private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrowser = false)
}
else
{
Process.Start(new ProcessStartInfo()
try
{
FileName = uri.AbsoluteUri,
UseShellExecute = true
})?.Dispose();

return;
Process.Start(new ProcessStartInfo()
{
FileName = uri.AbsoluteUri,
UseShellExecute = true
})?.Dispose();
}
catch (Exception e)
{
LogException(ClassName, $"Failed to open: {uri.AbsoluteUri}", e);
ShowMsgError(GetTranslation("errorTitle"), e.Message);
}
}
}

Expand Down Expand Up @@ -481,7 +492,7 @@ public void OpenAppUri(Uri appUri)
OpenUri(appUri);
}

public void ToggleGameMode()
public void ToggleGameMode()
{
_mainVM.ToggleGameMode();
}
Expand Down
Loading