Merge pull request #77 from Kelet/master
Put temporary file in %TEMP% on Windows
This commit is contained in:
commit
be96a87cc7
|
@ -102,18 +102,20 @@ end
|
||||||
|
|
||||||
function M.gotoDeclaration()
|
function M.gotoDeclaration()
|
||||||
local fileName = os.tmpname()
|
local fileName = os.tmpname()
|
||||||
local command = M.PATH_TO_DCD_CLIENT .. " -l -c" .. buffer.current_pos .. " > " .. fileName
|
|
||||||
local mode = "w"
|
local mode = "w"
|
||||||
if _G.WIN32 then
|
if _G.WIN32 then
|
||||||
|
fileName = os.getenv('TEMP') .. fileName
|
||||||
mode = "wb"
|
mode = "wb"
|
||||||
end
|
end
|
||||||
|
local command = M.PATH_TO_DCD_CLIENT .. " -l -c" .. buffer.current_pos ..
|
||||||
|
" > \"" .. fileName .. "\""
|
||||||
local p = io.popen(command, mode)
|
local p = io.popen(command, mode)
|
||||||
p:write(buffer:get_text())
|
p:write(buffer:get_text())
|
||||||
p:flush()
|
p:flush()
|
||||||
p:close()
|
p:close()
|
||||||
local tmpFile = io.open(fileName, "r")
|
local tmpFile = io.open(fileName, "r")
|
||||||
local r = tmpFile:read("*a")
|
local r = tmpFile:read("*a")
|
||||||
io.close(tmpFile)
|
tmpFile:close()
|
||||||
if r ~= "Not found\n" then
|
if r ~= "Not found\n" then
|
||||||
path, position = r:match("^(.-)\t(%d+)")
|
path, position = r:match("^(.-)\t(%d+)")
|
||||||
if (path ~= nil and position ~= nil) then
|
if (path ~= nil and position ~= nil) then
|
||||||
|
@ -139,18 +141,20 @@ end)
|
||||||
function M.autocomplete(ch)
|
function M.autocomplete(ch)
|
||||||
if buffer:get_lexer() ~= "dmd" then return end
|
if buffer:get_lexer() ~= "dmd" then return end
|
||||||
local fileName = os.tmpname()
|
local fileName = os.tmpname()
|
||||||
local command = M.PATH_TO_DCD_CLIENT .. " -c" .. buffer.current_pos .. " > " .. fileName
|
|
||||||
local mode = "w"
|
local mode = "w"
|
||||||
if _G.WIN32 then
|
if _G.WIN32 then
|
||||||
|
fileName = os.getenv('TEMP') .. fileName
|
||||||
mode = "wb"
|
mode = "wb"
|
||||||
end
|
end
|
||||||
|
local command = M.PATH_TO_DCD_CLIENT .. " -c" .. buffer.current_pos ..
|
||||||
|
" > \"" .. fileName .. "\""
|
||||||
local p = io.popen(command, mode)
|
local p = io.popen(command, mode)
|
||||||
p:write(buffer:get_text())
|
p:write(buffer:get_text())
|
||||||
p:flush()
|
p:flush()
|
||||||
p:close()
|
p:close()
|
||||||
local tmpFile = io.open(fileName, "r")
|
local tmpFile = io.open(fileName, "r")
|
||||||
local r = tmpFile:read("*a")
|
local r = tmpFile:read("*a")
|
||||||
io.close(tmpFile)
|
tmpFile:close()
|
||||||
if r ~= "\n" then
|
if r ~= "\n" then
|
||||||
if r:match("^identifiers.*") then
|
if r:match("^identifiers.*") then
|
||||||
showCompletionList(r)
|
showCompletionList(r)
|
||||||
|
|
Loading…
Reference in New Issue