I am attempting to fix the slidex package (converts Powerpoint [.pptx] to Xaringan) so it works on Windows. I keep hitting Access is denied errors when this line runs:
file.rename(file.path(basepath, "xml", "ppt", "media"),
file.path(basepath2, "assets", "img"))
Warning message:
In file.rename(file.path(basepath, "xml", "ppt", "media"), file.path(basepath2, :
cannot rename file 'C:\Users\rick2\AppData\Local\Temp\RtmpueUFV7/RCommunityOrg_useR2021/xml/ppt/media' to 'C:\Users\rick2\AppData\Roaming/RCommunityOrg_useR2021/assets/img', reason 'Access is denied'
I see both folders exist and the first has file. file.copy
instead of file.rename
also fails.
Now, I just discovered that adjusting every folder object with code resembling the following solves the problem (borrowed from R Markdown's code),
path <- gsub('/', '\\\\', path)
However, must I do this every time a folder is created with file.path()?