Skip to content

Commit c0afb19

Browse files
committed
allow custom explorer profile's File Manager Path to replace with path
greater flexibility with custom explorer profile
1 parent 7ac22d0 commit c0afb19

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public string Theme
9191
public double? SettingWindowTop { get; set; } = null;
9292
public double? SettingWindowLeft { get; set; } = null;
9393
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
94+
9495
public int CustomExplorerIndex { get; set; } = 0;
9596

9697
[JsonIgnore]
@@ -131,14 +132,6 @@ public CustomExplorerViewModel CustomExplorer
131132
Path = "Files",
132133
DirectoryArgument = "-select \"%d\"",
133134
FileArgument = "-select \"%f\""
134-
},
135-
new()
136-
{
137-
Name = "QTTabBar",
138-
Path = "Explorer",
139-
DirectoryArgument = "\"%d\"",
140-
FileArgument = "\"%f\"",
141-
Editable = false
142135
}
143136
};
144137

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
using System.Collections.Concurrent;
2626
using System.Diagnostics;
2727
using System.Collections.Specialized;
28-
using Flow.Launcher.Infrastructure.UserSettings;
2928

3029
namespace Flow.Launcher
3130
{
@@ -229,39 +228,22 @@ public void SavePluginSettings()
229228

230229
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
231230
{
232-
var customExplorerList = _settingsVM.Settings.CustomExplorerList;
231+
using var explorer = new Process();
233232
var explorerInfo = _settingsVM.Settings.CustomExplorer;
234233

235-
var qttabbarIndex = customExplorerList.FindIndex(e => e.Name.Equals("QTTABBAR", StringComparison.OrdinalIgnoreCase));
236-
var isQttabbarSelected = qttabbarIndex == _settingsVM.Settings.CustomExplorerIndex;
237-
238-
if (isQttabbarSelected)
239-
{
240-
Process.Start(new ProcessStartInfo
241-
{
242-
FileName = DirectoryPath,
243-
UseShellExecute = true,
244-
Verb = "open",
245-
Arguments = FileNameOrFilePath
246-
});
247-
}
248-
else
234+
explorer.StartInfo = new ProcessStartInfo
249235
{
250-
using var explorer = new Process();
251-
explorer.StartInfo = new ProcessStartInfo
252-
{
253-
FileName = explorerInfo.Path,
254-
UseShellExecute = true,
255-
Arguments = FileNameOrFilePath is null
256-
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
257-
: explorerInfo.FileArgument
258-
.Replace("%d", DirectoryPath)
259-
.Replace("%f",
260-
Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath)
261-
)
262-
};
263-
explorer.Start();
264-
}
236+
FileName = explorerInfo.Path.Replace("%d", DirectoryPath),
237+
UseShellExecute = true,
238+
Arguments = FileNameOrFilePath is null
239+
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
240+
: explorerInfo.FileArgument
241+
.Replace("%d", DirectoryPath)
242+
.Replace("%f",
243+
Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath)
244+
)
245+
};
246+
explorer.Start();
265247
}
266248

267249
private void OpenUri(Uri uri, bool? inPrivate = null)

0 commit comments

Comments
 (0)