@@ -58,12 +58,12 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
5858 val folder = sketch.folder
5959
6060 // Copy all Electron scaffolding mode’s `js` folder
61- var electronFolder = mode?.getContentFile(" js/electron " )
62- electronFolder?.copyTo( folder, true )
61+ var javascriptFolder = mode?.getContentFile(" js" )
62+ javascriptFolder?.resolve( " electron " )?.copyRecursively( folder.resolve( " electron " ) , true )
6363
6464 // Only copy `package.json` and `pnpm-lock.yaml` if not existent
65- mode?.getContentFile( " js/ package.json" )?.copyTo(folder)
66- mode?.getContentFile( " js/ pnpm-lock.yaml" )?.copyTo(folder)
65+ javascriptFolder?.resolve( " package.json" )?.copyTo(folder.resolve( " package.json " ) )
66+ javascriptFolder?.resolve( " pnpm-lock.yaml" )?.copyTo(folder.resolve( " pnpm-lock.yaml " ) )
6767
6868 createIndexHtml()
6969
@@ -293,7 +293,7 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
293293 while (reader.readLine().also { line = it } != null ) {
294294 // TODO: so much refactoring!
295295 // Only check for errors when running the sketch
296- if (action.startsWith( " npx " ) && line.startsWith(" error" )) {
296+ if (action == " pnpm sketch:start " && line.startsWith(" error" )) {
297297 // TODO: more robust data exchange, double-check with @Stef
298298 // TODO: `statusError` does not do anything with column of a SketchException
299299 val ( msgType, msgText, msgFile, msgLine, msgCol ) = line.split(" |" )
0 commit comments