Skip to content

Commit

Permalink
1.1.1 Fixed wrong directory generation
Browse files Browse the repository at this point in the history
Fixed wrong directory generation when file is in root of path
  Thanks for the help by @ndreas
  • Loading branch information
lukas-reineke committed Nov 2, 2020
1 parent 25b9d6d commit d4a9f7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion doc/format.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


Author: Lukas Reineke <lukas.reineke@protonmail.com>
Version: 1.1.0
Version: 1.1.1

==============================================================================
CONTENTS *format*
Expand Down Expand Up @@ -195,6 +195,10 @@ FormatWrite *FormatWrite*
==============================================================================
5. CHANGELOG *format-changelog*

1.1.1
* Fixed wrong directory generation when file is in root of path
Thanks for the help by @ndreas

1.1.0
* Added `tempfile_dir` option

Expand Down
8 changes: 7 additions & 1 deletion lua/format/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ function M.format(cmd, options, callback)
tempfile_postfix
)
split_bufname[#split_bufname] = nil
local tempfile_name = (options.tempfile_dir or table.concat(split_bufname, "/")) .. "/" .. filename
local tempfile_dir = table.concat(split_bufname, "/")
if tempfile_dir == "" then
tempfile_dir = "."
end
local tempfile_name = (options.tempfile_dir or tempfile_dir) .. "/" .. filename

print(tempfile_name)

local tempfile = io.open(tempfile_name, "w+")
for _, line in pairs(lines) do
Expand Down

0 comments on commit d4a9f7e

Please sign in to comment.