-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfig.coffee
35 lines (31 loc) · 1.03 KB
/
config.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ execSync } = require 'child_process'
path = require 'path'
os = require 'os'
texmfBibtexPath = undefined
getTexmfBibtexPath = ->
unless texmfBibtexPath?
ENV = null
if process.platform == 'darwin'
ENV = { PATH: ['/Library/TeX/texbin',process.env.PATH].join(":") }
try
output = execSync('kpsewhich -var-value TEXMFHOME',
{ env: ENV, encoding: 'utf8'})
texmfBibtexPath = path.normalize(output.trim())
catch
texmfBibtexPath = ''
if texmfBibtexPath
texmfBibtexPath = path.join(texmfBibtexPath,'bibtex','bib')
if process.platform == 'darwin'
texmfBibtexPath = path.join(os.homedir(),texmfBibtexPath)
return texmfBibtexPath
module.exports =
globalBibPath:
type: 'string'
order: 2
default: getTexmfBibtexPath()
description: 'The path of for global bibtex libary files. Defaults to the texmf folder.'
includeGlobalBibFiles:
type: 'boolean'
order: 1
default: false
description: 'Add the bibtex entries in the global files to the suggestions list.'