vadimdemedes / ronin

Toolkit for killer CLI applications
http://vdemedes.github.io/ronin
MIT License
299 stars 15 forks source link

Windows: paths to files in commands folder are broken #33

Open pulkitsinghal opened 8 years ago

pulkitsinghal commented 8 years ago

This issue has resurfaced: https://github.com/vdemedes/ronin/issues/13

I see errors such as: Cannot find module 'c:\dev\vend-tools\commands\C:dev\vend-tools\commands\mycommand.js

I'm using version 0.3.9 of ronin and looking through commits I haven't seen any significant updates that would fix this by simply using the newest version.

Node Version is 0.10.43

pulkitsinghal commented 8 years ago

Tested with:

      console.log(path.replace(/\//g, separator));
      console.log(path.replace(/\//g, separator).replace(/^./, function ($1) {
        return $1.toUpperCase();
      }));
      console.log(path.replace(/\//g, separator).replace(/^./, function ($1) {
        return $1.toUpperCase();
      }).replace(join(_this.path, "commands"), ""));
      console.log(path.replace(/\//g, separator).replace(/^./, function ($1) {
        return $1.toUpperCase();
      }).replace(join(_this.path, "commands"), "").replace(separator, ""));

Outputs:

c:\dev\vend-tools\commands\configure.js
C:\dev\vend-tools\commands\configure.js
C:\dev\vend-tools\commands\configure.js
C:dev\vend-tools\commands\configure.js

Which means the code in windows starts breaking due to the last .replace(separator, "") in the chain ... there is probably a good reason why you have it there, so I'm wondering what purpose does this serve in non-windows systems ... or can I submit a PR after removing it?