Closed MichaelPaulukonis closed 9 years ago
Running node node-demo.js throws an error:
node node-demo.js
Error: ENOENT, open 'd:\font\doh.flf'
Brief poking about shows that asciimo.js branched onto the else path of the following:
asciimo.js
// Remark : not a very good env check var fontPath; if(typeof __dirname == 'undefined'){ fontPath = './fonts/'; } else{ fontPath = __dirname.substring(0, __dirname.lastIndexOf("/")) + '/fonts/'; }
The windows path-separator is "\\", which works in a dumb-windows-only-replacement.
"\\"
The following is a better patch:
// Remark : not a very good env check var fontPath; if(typeof __dirname == 'undefined'){ fontPath = './fonts/'; } else{ fontPath = __dirname.substring(0, __dirname.lastIndexOf(require('path').sep)) + '/fonts/'; }
Although I'm itchy about the use of require for just one thing.
require
Is there a better fix? Are there other places in the code that should be fixed?
I plan on putting a pull-request through for this.
That's a lousy fix -- since it won't work in the browser.
It needs to be something that works in node.js (os-agnostic) AND the browser....
https://github.com/IonicaBizau/jasciimo#deprecation-notice
Running
node node-demo.js
throws an error:Brief poking about shows that
asciimo.js
branched onto the else path of the following:The windows path-separator is
"\\"
, which works in a dumb-windows-only-replacement.The following is a better patch:
Although I'm itchy about the use of
require
for just one thing.Is there a better fix? Are there other places in the code that should be fixed?
I plan on putting a pull-request through for this.