soef / iobroker.js2fs

replicate ioBroker scripts to files
MIT License
6 stars 0 forks source link

Filepath handling incomptible with Linux! #2

Closed Apollon77 closed 7 years ago

Apollon77 commented 7 years ago

I tested the adapter on my installation and go the following result:

ls -la

drwxrwxrwx  2 root  root   4096 Aug 23 00:10 \Anwesenheit
-rw-rw-rw-  1 root  root   1602 Aug 23 00:06 \Anwesenheit\CCUioDaten.js
-rw-rw-rw-  1 root  root    700 Aug 23 00:06 \Anwesenheit\Geofency-Cloud-Mapper.js
-rw-rw-rw-  1 root  root   3609 Aug 23 00:06 \Anwesenheit\Monitor-Handy-Changes.js
drwxrwxrwx  2 root  root   4096 Aug 23 00:10 \Anzeigen
-rw-rw-rw-  1 root  root  10363 Aug 23 00:06 \Anzeigen\EG-LED-Anzeige.js
-rw-rw-rw-  1 root  root   8862 Aug 23 00:06 \Anzeigen\Status-Zaehler.js
-rw-rw-rw-  1 root  root   2065 Aug 23 00:06 \Anzeigen\SurveillanceStation-URLs.js
-rw-rw-rw-  1 root  root   5589 Aug 23 00:06 \Anzeigen\Vis-View-Steuerung.js
-rw-rw-rw-  1 root  root   1665 Aug 23 00:06 \Anzeigen\Vis-View-Wechseln.js
drwxrwxrwx  2 root  root   4096 Aug 23 00:10 \Arduino
-rw-rw-rw-  1 root  root   9827 Aug 23 00:06 \Arduino\Daten.js

The whole handling seems to be focussed on WIndows for now.

BTW: With nodejs (as I also learned some time ago) the preferred way to build path's is e.g. https://nodejs.org/api/path.html#path_path_join_paths ... So maybe use "split('.') and use this array to build the platform independent path for the files?!

Apollon77 commented 7 years ago

I decided to work on that ... I prepare a pull request ... I have reworked much of the path handling to use the "path" functions that work cross-os. And I add some testing :-) So stay tuned :-)