Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to create a directory string variable which is '.appsrcalgorithms' to use it in exec function in node on Windows Platform. However, it doesn not work properly even use double backslashes in the string. Here is my try;

λ node
> directory =  '.appsrcalgorithms';
'.appsrcalgorithms'
> directory =  '.\app\src\algorithms';
'.\app\src\algorithms'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
280 views
Welcome To Ask or Share your Answers For Others

1 Answer

I think the best way to handle platform independent work with path is using path module. E.g.

var path = require('path');
var directory = path.join('.', 'app', 'src', 'algorithms')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...