Skip to content

Commit

Permalink
fix: avoid issues with events_file_path having spaces
Browse files Browse the repository at this point in the history
If the user used a path with spaces for their config.events_file_path
setting, it caused an issue. No issues like this have been reported
though.
  • Loading branch information
mikavilpas committed May 13, 2024
1 parent e375060 commit a6d918f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lua/yazi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function M.yazi(config, path)

os.remove(config.chosen_file_path)
local cmd = string.format(
'yazi "%s" --local-events "rename,delete,trash,move" --chooser-file "%s" > %s',
'yazi "%s" --local-events "rename,delete,trash,move" --chooser-file "%s" > "%s"',
path_utils.escape_path_for_cmd(path),
config.chosen_file_path,
config.events_file_path
Expand Down
2 changes: 1 addition & 1 deletion tests/yazi/open_dir_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('when the user set open_for_directories = true', function()
vim.api.nvim_command('edit /')

assert.stub(api_mock.termopen).was_called_with(
'yazi "/" --local-events "rename,delete,trash,move" --chooser-file "/tmp/yazi_filechosen" > /tmp/yazi.nvim.events.txt',
'yazi "/" --local-events "rename,delete,trash,move" --chooser-file "/tmp/yazi_filechosen" > "/tmp/yazi.nvim.events.txt"',
match.is_table()
)
end)
Expand Down
4 changes: 2 additions & 2 deletions tests/yazi/yazi_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('opening a file', function()
})

assert.stub(api_mock.termopen).was_called_with(
'yazi "/abc/test-file-\\$1.txt" --local-events "rename,delete,trash,move" --chooser-file "/tmp/yazi_filechosen" > /tmp/yazi.nvim.events.txt',
'yazi "/abc/test-file-\\$1.txt" --local-events "rename,delete,trash,move" --chooser-file "/tmp/yazi_filechosen" > "/tmp/yazi.nvim.events.txt"',
match.is_table()
)
end)
Expand All @@ -55,7 +55,7 @@ describe('opening a file', function()
})

assert.stub(api_mock.termopen).was_called_with(
'yazi "/tmp/" --local-events "rename,delete,trash,move" --chooser-file "/tmp/yazi_filechosen" > /tmp/yazi.nvim.events.txt',
'yazi "/tmp/" --local-events "rename,delete,trash,move" --chooser-file "/tmp/yazi_filechosen" > "/tmp/yazi.nvim.events.txt"',
match.is_table()
)
end)
Expand Down

0 comments on commit a6d918f

Please sign in to comment.