Refactor OpenDirectory method to standardize parameter naming and improve path handling

This commit is contained in:
DB p 2025-05-17 15:16:34 +09:00
parent 050c2cb647
commit b5bbd9f123

View file

@ -314,19 +314,19 @@ namespace Flow.Launcher
((PluginJsonStorage<T>)_pluginJsonStorages[type]).Save();
}
public void OpenDirectory(string directoryPath, string fileNameOrFilePath = null)
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
{
string targetPath;
if (fileNameOrFilePath is null)
if (FileNameOrFilePath is null)
{
targetPath = directoryPath;
targetPath = DirectoryPath;
}
else
{
targetPath = Path.IsPathRooted(fileNameOrFilePath)
? fileNameOrFilePath
: Path.Combine(directoryPath, fileNameOrFilePath);
targetPath = Path.IsPathRooted(FileNameOrFilePath)
? FileNameOrFilePath
: Path.Combine(DirectoryPath, FileNameOrFilePath);
}
var explorerInfo = _settings.CustomExplorer;
@ -346,12 +346,12 @@ namespace Flow.Launcher
// Custom File Manager
var psi = new ProcessStartInfo
{
FileName = explorerInfo.Path.Replace("%d", directoryPath),
FileName = explorerInfo.Path.Replace("%d", DirectoryPath),
UseShellExecute = true,
Arguments = fileNameOrFilePath is null
? explorerInfo.DirectoryArgument.Replace("%d", directoryPath)
Arguments = FileNameOrFilePath is null
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
: explorerInfo.FileArgument
.Replace("%d", directoryPath)
.Replace("%d", DirectoryPath)
.Replace("%f", targetPath)
};