Skip to content

Commit

Permalink
fix: Create temp file in the same dir as the current active vim buffer (
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Nov 17, 2019
1 parent b2cdaf8 commit 685d8b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion generators/libclang.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def main():

file_ext = vim.eval("expand('%:p:e')")
ext = file_ext if file_ext else vim.eval('&filetype')
workdir = vim.eval("expand('%:p:h')")

lines = vim.eval("getline(line(1), line('$'))")
current_line = int(vim.eval("line('.')"))
Expand All @@ -148,7 +149,7 @@ def main():
lines.insert(current_line-1, normalized_expr)

# Save the lines to a temp file and parse that file.
fd, filename = tempfile.mkstemp('.{}'.format(ext))
fd, filename = tempfile.mkstemp('.{}'.format(ext), dir=workdir)
try:
with os.fdopen(fd, 'w') as tmp:
tmp.write('\n'.join(lines))
Expand Down

0 comments on commit 685d8b1

Please sign in to comment.