win_jpeg_lookup.js 360 B

123456789101112131415161718192021
  1. const fs = require('fs')
  2. const paths = ['C:/libjpeg-turbo']
  3. if (process.arch === 'x64') {
  4. paths.unshift('C:/libjpeg-turbo64')
  5. }
  6. paths.forEach(function (path) {
  7. if (exists(path)) {
  8. process.stdout.write(path)
  9. process.exit()
  10. }
  11. })
  12. function exists (path) {
  13. try {
  14. return fs.lstatSync(path).isDirectory()
  15. } catch (e) {
  16. return false
  17. }
  18. }