Fixes #1361. Add file extension to temporary files for Uncrustify beautifier

This commit is contained in:
Glavin Wiechert 2017-06-16 20:33:19 -03:00
parent 7899be966b
commit 40f1fe3c8d
2 changed files with 7 additions and 4 deletions

View File

@ -282,6 +282,7 @@ module.exports = class Beautifiers extends EventEmitter
logger.verbose(allOptions)
language ?= @getLanguage(grammar, filePath)
fileExtension = @getExtension(filePath)
# Check if unsupported language
if !language
@ -343,6 +344,7 @@ module.exports = class Beautifiers extends EventEmitter
context =
filePath: filePath
fileExtension: fileExtension
startTime = new Date()
beautifier.loadExecutables()
@ -405,7 +407,6 @@ module.exports = class Beautifiers extends EventEmitter
if atom.config.get("atom-beautify.general.muteUnsupportedLanguageErrors")
return resolve( null )
else
fileExtension = @getExtension(filePath)
repoBugsUrl = pkg.bugs.url
title = "Atom Beautify could not find a supported beautifier for this file"
detail = """

View File

@ -46,7 +46,9 @@ module.exports = class Uncrustify extends Beautifier
Arduino: true
}
beautify: (text, language, options) ->
beautify: (text, language, options, context) ->
fileExtension = context.fileExtension
uncrustify = @exe("uncrustify")
# console.log('uncrustify.beautify', language, options)
return new @Promise((resolve, reject) ->
@ -99,9 +101,9 @@ module.exports = class Uncrustify extends Beautifier
"-c"
configPath
"-f"
@tempFile("input", text)
@tempFile("input", text, fileExtension and ".#{fileExtension}")
"-o"
outputFile = @tempFile("output", text)
outputFile = @tempFile("output", text, fileExtension and ".#{fileExtension}")
"-l"
lang
])