Merge pull request #1135 from StevenIsaacs/uncrustify-config-path

Change path to uncrustify config file to be relative to the project rather than the open file.
This commit is contained in:
Glavin Wiechert 2016-09-11 19:58:22 -03:00 committed by GitHub
commit 243fa4167c
1 changed files with 5 additions and 3 deletions

View File

@ -38,16 +38,18 @@ module.exports = class Uncrustify extends Beautifier
editor = atom.workspace.getActiveTextEditor()
if editor?
basePath = path.dirname(editor.getPath())
# Expand Home Directory in Config Path
configPath = expandHomeDir(configPath)
projectPath = atom.workspace.project.getPaths()[0]
# console.log(basePath);
configPath = path.resolve(basePath, configPath)
# Expand Home Directory in Config Path
expandedConfigPath = expandHomeDir(configPath)
configPath = path.resolve(projectPath, expandedConfigPath)
resolve configPath
else
reject(new Error("No Uncrustify Config Path set! Please configure Uncrustify with Atom Beautify."))
)
.then((configPath) =>
# Select Uncrustify language
lang = "C" # Default is C
switch language