AvinZarlez / processing-vscode

A Visual Studio Code extension for the programming language Processing
https://marketplace.visualstudio.com/items?itemName=Tobiah.language-pde
MIT License
177 stars 25 forks source link

Build path on Mac seems wrong: \ vs / #8

Closed taseenb closed 6 years ago

taseenb commented 7 years ago

I installed the extension on VS Code 1.15.1 on Mac OS Sierra and i cannot compile the sketches. To reproduce:

Error in console: incorrect classpath: /blabla/sketch\out java.io.FileNotFoundException:/blabla/sketch/out/source/noise_blur.java (No such file or directory)

Notice that out uses the backslash symbol (\) instead of the normal slash (/). The .java file is then created in a folder literally called sketch\out in mac (and it's not launched from VS Code, since it cannot find it).

AvinZarlez commented 7 years ago

Good find. I have not looked up recently, but I am not sure how to have the extension detect the current user's OS/platform in order to use the proper pathing.

Ideally, I'd love to be able to do a check, and if Mac do X and if Windows do Y. But I haven't seen how to do that in the documentation so far, so unless I'm missing it I'm not sure how to check it. Meaning, I am not sure how to fix this extension for Mac without breaking it on Windows.

taseenb commented 7 years ago

VS Code is based on Electron (I guess?), which is based on Node. I've never used it, but i suppose the Node API should work, so if you can access the Node process object, you should be able to get the platform: process.platform

It should return strings like darwin, linux or win32

https://nodejs.org/api/process.html#process_process_platform

AvinZarlez commented 7 years ago

Aha! That sound work. Just need to add the tweak now. I don't know when I'll have time to tackle it myself, but happy to take a PR if somebody wants to do it themselves.

I'd imagine it's simply adding two different Tasks.json template files (one for Windows and one for Mac, this would also help with #7 's enhancement) and then load the correct one based on platform.

cgilmore commented 6 years ago

Perhaps I'm reading the issue wrong, so I don't know if this is a "real" solution, but I just changed in the tasks.json, "--output=${workspaceRoot}\\out" to "--output=${workspaceRoot}/out" and it seems to build ok now.

If this wasn't the problem you're talking about and solves nothing, I apologize for butting in. 😊

polyclick commented 6 years ago

I'd suggest putting this in the readme. I stumbled onto this problem as well.

AvinZarlez commented 6 years ago

I haven't had time to tackle this due to other work. I'd love to do a proper fix with @taseenb 's suggestion to pick the appropriate task file template based on platform. But I'd also accept a PR that just explains the problem in the readme

austince commented 6 years ago

Could we also use just node's Path API and build the task.json config dynamically? It handles all native system file structure for us.

AvinZarlez commented 6 years ago

This issue should be resolved in #15 , which has been merged