I'm trying to run a Rake task on my computer running Windows but I'm having problem with the file paths. The rakefile was originally written by a user running Mac and OSX.
def compile
`cp -r app/assets/images dist/`
...
end
Running the task above gives me an error: Errno::ENOENT: No such file or directory - cp -r app/assets/images dist/
The folders are there and the following command works in the terminal:
cp -r .\app\assets\images dist\
However, changing the command in the rake file to the following doesn't work:
`cp -r .\\app\\assets\\images dist\\`
Is there some way to run the original rakefile on my Windows machine? That would be the best. If that's not possible, how can I update the rakefile to make it work?
You'll have to modify the Rakefile. Main issue is that
cpis an UNIX command and Windows usescopy/xcopy. I'm not a Windows expert, but I believexcopy /Eis for recursive copy.I believe you can verify that Ruby will validate files paths by running:
The best solution IMO is to use FileUtils: