Skip to content

Commit a919254

Browse files
TheBestPessimistTheBestPessimist
authored andcommitted
Make code more readable
1 parent 436ec7d commit a919254

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ public interface IPublicAPI
233233
/// Open directory in an explorer configured by user via Flow's Settings. The default is Windows Explorer
234234
/// </summary>
235235
/// <param name="DirectoryPath">Directory Path to open</param>
236-
/// <param name="FileName">Extra FileName Info</param>
237-
public void OpenDirectory(string DirectoryPath, string FileName = null);
236+
/// <param name="FileNameOrFilePath">Extra FileName Info</param>
237+
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null);
238238

239239
/// <summary>
240240
/// Opens the URL with the given Uri object.

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
 using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Net;
@@ -195,17 +195,20 @@ public void SavePluginSettings()
195195
((PluginJsonStorage<T>)_pluginJsonStorages[type]).Save();
196196
}
197197

198-
public void OpenDirectory(string DirectoryPath, string FileName = null)
198+
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
199199
{
200200
using var explorer = new Process();
201201
var explorerInfo = _settingsVM.Settings.CustomExplorer;
202202
explorer.StartInfo = new ProcessStartInfo
203203
{
204204
FileName = explorerInfo.Path,
205-
Arguments = FileName is null ?
206-
explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath) :
207-
explorerInfo.FileArgument.Replace("%d", DirectoryPath).Replace("%f",
208-
Path.IsPathRooted(FileName) ? FileName : Path.Combine(DirectoryPath, FileName))
205+
Arguments = FileNameOrFilePath is null
206+
? explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath)
207+
: explorerInfo.FileArgument
208+
.Replace("%d", DirectoryPath)
209+
.Replace("%f",
210+
Path.IsPathRooted(FileNameOrFilePath) ? FileNameOrFilePath : Path.Combine(DirectoryPath, FileNameOrFilePath)
211+
)
209212
};
210213
explorer.Start();
211214
}

0 commit comments

Comments
 (0)