visual-studio-codesvgbpmnkogito

Unable to export SVG of bpmn in VScode, Unknown FileSystem Error


I had created and executed a BPMN process using VSCode. I was able to run the process successfully. But on trying to import the SVG, getting the following error Unable to write file 'c:\Program Files\Microsoft VS Code\d:\Projects{mypath}\src\main\resources\Sample-svg.svg' (Unknown (FileSystemError): Error: EINVAL: invalid argument, mkdir 'c:\Program Files\Microsoft VS Code\d:')

Saw issue might be of write access, but unable to obtain it. VSCode version: 1.64.2

Added all bpmn and java extensions needed.

Have also tried starting and running as admin, provided the app all required write permissions in app security, still no change.


Solution

  • This seems to be a bug in how NodeJS's path.resolve resolves a different drive path.

    This is how the path where the SVG will be exported is defined:

    const svgUri = editor.document.uri.with({ path: __path.resolve(svgFilePath, svgFileName) });
    

    By default, the SVG is exported to fileDirname, which is the path where your BPMN file is. But in this case path.resolve is appending this path "c:\Program Files\Microsoft VS Code".

    A simple way to workaround/fix this is to go to your VSCode Settings and find the Kogito > Bpmn: Svg File Path settings and add a forward slash (/) before "${fileDirname}", leaving the setting with the value: "/${fileDirname}".

    Or you can edit your VSCode's settings.json file, adding this property:

    {
       ...
       "kogito.bpmn.svgFilePath": "/${fileDirname}"
    }
    

    Kogito > Bpmn: Svg File Path setting