Double backslash prints the same in node

前端 未结 2 1555
挽巷
挽巷 2021-01-29 04:01

I want to create a directory string variable which is \'.\\app\\src\\algorithms\' to use it in exec function in node on Windows Platform. However, it doesn not work properly ev

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 04:25

    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')
    

提交回复
热议问题