Skip to content

Commit 6b8e93b

Browse files
authored
Merge pull request #1838 from tyrielv/hooks-quotes
Use quotes around default GVFS.Hooks.exe configuration
2 parents 39b0342 + 346ccf4 commit 6b8e93b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

GVFS/GVFS.Common/FileSystem/HooksInstaller.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ static HooksInstaller()
2828
public static string MergeHooksData(string[] defaultHooksLines, string filename, string hookName)
2929
{
3030
IEnumerable<string> valuableHooksLines = defaultHooksLines.Where(line => !string.IsNullOrEmpty(line.Trim()));
31-
string absolutePathToHooksExecutable = Path.Combine(ExecutingDirectory, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
31+
/* Wrap in quotes to handle spaces in the path */
32+
string absolutePathToHooksExecutable = $"\"{Path.Combine(ExecutingDirectory, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName)}\"";
3233

3334
if (valuableHooksLines.Contains(GVFSPlatform.Instance.Constants.GVFSHooksExecutableName, GVFSPlatform.Instance.Constants.PathComparer))
3435
{

GVFS/GVFS.UnitTests/CommandLine/HooksInstallerTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ public class HooksInstallerTests
1616
{
1717
private const string Filename = "hooksfile";
1818
private readonly string expectedAbsoluteGvfsHookPath =
19-
Path.Combine(
20-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
21-
GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
19+
$"\"{Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), GVFSPlatform.Instance.Constants.GVFSHooksExecutableName)}\"";
2220

2321
[TestCase]
2422
[Category(CategoryConstants.ExceptionExpected)]

0 commit comments

Comments
 (0)