mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #13 from Flow-Launcher/fix_settings_openurl
Fix Process.Start on urls and directories
This commit is contained in:
commit
21bf506bf9
5 changed files with 18 additions and 20 deletions
|
|
@ -7,6 +7,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
{
|
||||
public static class FilesFolders
|
||||
{
|
||||
private const string FileExplorerProgramName = "explorer";
|
||||
public static void Copy(this string sourcePath, string targetPath)
|
||||
{
|
||||
// Get the subdirectories for the specified directory.
|
||||
|
|
@ -111,10 +112,11 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
|||
|
||||
public static void OpenLocationInExporer(string location)
|
||||
{
|
||||
var psi = new ProcessStartInfo { FileName = FileExplorerProgramName, UseShellExecute = true, Arguments = location };
|
||||
try
|
||||
{
|
||||
if (LocationExists(location))
|
||||
Process.Start(location);
|
||||
Process.Start(psi);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using System.Windows.Documents;
|
|||
using Flow.Launcher.Helper;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -51,8 +52,8 @@ namespace Flow.Launcher
|
|||
var link = new Hyperlink { IsEnabled = true };
|
||||
link.Inlines.Add(url);
|
||||
link.NavigateUri = new Uri(url);
|
||||
link.RequestNavigate += (s, e) => Process.Start(e.Uri.ToString());
|
||||
link.Click += (s, e) => Process.Start(url);
|
||||
link.RequestNavigate += (s, e) => SearchWeb.NewBrowserWindow(e.Uri.ToString());
|
||||
link.Click += (s, e) => SearchWeb.NewBrowserWindow(url);
|
||||
|
||||
paragraph.Inlines.Add(textBeforeUrl);
|
||||
paragraph.Inlines.Add(link);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Win32;
|
||||
using NHotkey;
|
||||
using NHotkey.Wpf;
|
||||
using Flow.Launcher.Core;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
namespace Flow.Launcher
|
||||
|
|
@ -233,7 +229,7 @@ namespace Flow.Launcher
|
|||
var uri = new Uri(website);
|
||||
if (Uri.CheckSchemeName(uri.Scheme))
|
||||
{
|
||||
Process.Start(website);
|
||||
SearchWeb.NewBrowserWindow(website);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -244,10 +240,8 @@ namespace Flow.Launcher
|
|||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
var directory = _viewModel.SelectedPlugin.PluginPair.Metadata.PluginDirectory;
|
||||
if (!string.IsNullOrEmpty(directory) && Directory.Exists(directory))
|
||||
{
|
||||
Process.Start(directory);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(directory))
|
||||
FilesFolders.OpenLocationInExporer(directory);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -269,7 +263,7 @@ namespace Flow.Launcher
|
|||
|
||||
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
SearchWeb.NewBrowserWindow(e.Uri.AbsoluteUri);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using Flow.Launcher.Infrastructure.Hotkey;
|
|||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using Flow.Launcher.Storage;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
|
|
@ -130,7 +131,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
StartHelpCommand = new RelayCommand(_ =>
|
||||
{
|
||||
Process.Start("http://doc.wox.one/");
|
||||
SearchWeb.NewBrowserWindow("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/");
|
||||
});
|
||||
|
||||
OpenResultCommand = new RelayCommand(index =>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Windows;
|
|||
using System.Windows.Controls;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Folder
|
||||
{
|
||||
|
|
@ -18,8 +19,7 @@ namespace Flow.Launcher.Plugin.Folder
|
|||
public const string CopyImagePath = "Images\\copy.png";
|
||||
|
||||
private string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
|
||||
|
||||
private const string _fileExplorerProgramName = "explorer";
|
||||
|
||||
private static List<string> _driverNames;
|
||||
private PluginInitContext _context;
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ namespace Flow.Launcher.Plugin.Folder
|
|||
{
|
||||
try
|
||||
{
|
||||
Process.Start(_fileExplorerProgramName, path);
|
||||
FilesFolders.OpenLocationInExporer(path);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -255,7 +255,7 @@ namespace Flow.Launcher.Plugin.Folder
|
|||
{
|
||||
try
|
||||
{
|
||||
Process.Start(_fileExplorerProgramName, filePath);
|
||||
FilesFolders.OpenLocationInExporer(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -286,7 +286,7 @@ namespace Flow.Launcher.Plugin.Folder
|
|||
Score = 500,
|
||||
Action = c =>
|
||||
{
|
||||
Process.Start(_fileExplorerProgramName, search);
|
||||
FilesFolders.OpenLocationInExporer(search);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue