mercredi 18 février 2015

Node.js- Splitting up File Path with string.split()... Top Level File Gets Excluded

I have these routines that split up the file path. The issue that I am having is with /home/one/github/load-balancer-service/app/js/app.coffee. It seems to exclude the app.coffee and just leaves /js/ for srcFile


Not sure why. Any ideas? For files in sub directories underneath js/foo/file.coffee it's not a issue.



srcPath = "app";
console.log(streamObject.history[0]);
var projectDir = streamObject.history[0].split(srcPath)[0];
console.log(projectDir);
var srcFile = streamObject.history[0].split(srcPath)[1];
console.log(srcFile);




output:



/home/one/github/load-balancer-service/app/js/app.coffee
/home/one/github/load-balancer-service/
/js/

Aucun commentaire:

Enregistrer un commentaire