natevw / fatfs

Standalone FAT16/FAT32 filesystem implementation in JavaScript
47 stars 13 forks source link

Cannot find module 'struct-fu/8to16' #22

Closed jviotti closed 8 years ago

jviotti commented 8 years ago

This being conditionally required here: https://github.com/natevw/fatfs/blob/master/dir.js#L271

var workaroundTessel427 = ('\uFFFF'.length !== 1);
...
paddedName = (workaroundTessel427) ? require('struct-fu/8to16').fixString(name) : name

However such file doesn't exist in struct-fu. Is this functionally no needed anymore?

I don't this this module should breaking encapsulation by requiring an internal file from within a module, since this can change without warning.

jviotti commented 8 years ago

Such file was completely removed here: https://github.com/natevw/struct-fu/commit/2db03c4278aa5e587272161de7b4799d88773408, which I guess confirms that the workaround is not needed anymore.

natevw commented 8 years ago

What firmware is your Tessel? The thing is, if the workaround is not needed then workaroundTessel427 should be false and the file shouldn't be requested.

I've incorporated your PR (thanks!) and finished cleaning out that old workaround. However, now instead of a "cannot find module" error, you will get a specific assertion if the string handling of your JS platform is not correct. By upgrading your board firmware, you should be able to use fatfs again but please let me know if this is not the case.

jviotti commented 8 years ago

@natevw I'm not running this in a Tessel, just on NodeJS in OS X/Linux/Windows.

natevw commented 8 years ago

@jviotti Strange. Any idea why ('\uFFFF'.length !== 1) would be true in your environment, and/or the require getting used despite it being false? Are you using some sort of bundler that just greps for require statements?

jviotti commented 8 years ago

@natevw Hm I didn't think of that. I'm actually using http://enclosejs.com so it makes sense that the module blindly parses require calls.