I use gulp and I need to somehow transfer to gulp.dest path from the root folder of the system, not the project.

I know that you can use a construction like ../../ , but this is not suitable because if you move the folder with the project to another place, everything will break.

    2 answers 2

    The root (in the case of Windows, the root of the current disk) is indicated by the slash: /smth/abc .

    In the case of Windows, the path with the drive letter should be considered absolute, but if not, you can try to put a slash or three slashes in front of it too.

    • Well, there is in fact not only Windows. I now thought that I was not sure that gulp.dest could handle this path. Probably you need to take the absolute path in the system and turn it into a relative from the project. But I'm not sure :-( - dmitryshishkin
    • @dmitryshishkin, and what will prevent him from processing? - Qwertiy ♦

    You can use path.relative

     var relativePath = path.relative(process.cwd(), someFilePath);