Skip to content
Merged
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
42 changes: 30 additions & 12 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

// Must use getter to avoid circular dependency
private Updater _updater;
private Updater Updater => _updater ??= Ioc.Default.GetRequiredService<Updater>();

Check warning on line 49 in Flow.Launcher/PublicAPIInstance.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

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

private readonly object _saveSettingsLock = new();

Expand Down Expand Up @@ -142,7 +142,7 @@
ShellCommand.Execute(startInfo);
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]

Check warning on line 145 in Flow.Launcher/PublicAPIInstance.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`VSTHRD` is not a recognized word. (unrecognized-spelling)
public async void CopyToClipboard(string stringToCopy, bool directCopy = false, bool showDefaultNotification = true)
{
if (string.IsNullOrEmpty(stringToCopy))
Expand Down Expand Up @@ -318,19 +318,37 @@
{
using var explorer = new Process();
var explorerInfo = _settings.CustomExplorer;

explorer.StartInfo = new ProcessStartInfo
var explorerPath = explorerInfo.Path.Trim().ToLowerInvariant();
var targetPath = FileNameOrFilePath is null
? DirectoryPath
: Path.IsPathRooted(FileNameOrFilePath)
? FileNameOrFilePath
: Path.Combine(DirectoryPath, FileNameOrFilePath);

if (Path.GetFileNameWithoutExtension(explorerPath) == "explorer")
{
FileName = explorerInfo.Path.Replace("%d", DirectoryPath),
UseShellExecute = true,
Arguments = FileNameOrFilePath is null
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
: explorerInfo.FileArgument
.Replace("%d", DirectoryPath)
.Replace("%f",
Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath)
)
};
// Windows File Manager
// We should ignore and pass only the path to Shell to prevent zombie explorer.exe processes
explorer.StartInfo = new ProcessStartInfo
{
FileName = targetPath, // Not explorer, Only path.
UseShellExecute = true // Must be true to open folder
};
}
else
{
// Custom File Manager
explorer.StartInfo = new ProcessStartInfo
{
FileName = explorerInfo.Path.Replace("%d", DirectoryPath),
UseShellExecute = true,
Arguments = FileNameOrFilePath is null
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
: explorerInfo.FileArgument
.Replace("%d", DirectoryPath)
.Replace("%f", targetPath)
};
}
explorer.Start();
}

Expand Down
Loading