ClangSharp icon indicating copy to clipboard operation
ClangSharp copied to clipboard

System.UnauthorizedAccessException: Access to the path is denied

Open smaybius opened this issue 1 year ago • 2 comments

When I try outputting to a folder that's created in Visual Studio, whether it's in the command line or as an msbuild event, it says access to that folder is denied.

ClangSharpPInvokeGenerator -n MiniAudioSharp -f extern/miniaudio/miniaudio.h -o libs/bindings/Miniaudio --include-directory $VCINSTALLDIR\Tools\Llvm\lib\clang\17\include

smaybius avatar Apr 27 '24 17:04 smaybius

Or with the trailing slash, I get the System.IO.DirectoryNotFoundException instead, even if that directory perfectly exists.

smaybius avatar May 22 '24 21:05 smaybius

The issue here is that the tool defaults to single-file output and so -o libs/bindings/Miniaudio fails if there is an existing folder with that name. There's probably a better diagnostic that we could give (explicitly checking if the output path exists as a folder for single-file mode or as a file for multiple-file mode).

You'll want to pass in -c multi-file (or --config multi-file) to resolve the issue

tannergooding avatar May 24 '24 14:05 tannergooding