Skip to content

Commit

Permalink
minor updates to autofind
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Mar 6, 2024
1 parent 331b337 commit 450dc30
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions packages/nexrender-core/src/helpers/autofind.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,8 @@ const defaultPaths = {
],
}

/**
* Attemnt to find a aebinary path automatically
* (using a table of predefined paths)
* @param {Object} settings
* @return {String|null}
*/
module.exports = settings => {

const findAll = settings => {
let platform = os.platform()

if (settings.wsl) platform = 'wsl'
Expand All @@ -100,6 +95,21 @@ module.exports = settings => {
.map(folderPath => path.join(folderPath, binary))
.filter(binaryPath => fs.existsSync(binaryPath))

return results
}

/**
* Attemnt to find a aebinary path automatically
* (using a table of predefined paths)
* @param {Object} settings
* @return {String|null}
*/
module.exports = settings => {
const results = findAll(settings)

// return first matched result
return results.length ? results[0] : null;
}

module.exports.defaultPaths = defaultPaths
module.exports.findAll = findAll

0 comments on commit 450dc30

Please sign in to comment.