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

Backslashes are getting ommited on Windows [BUG] #68

Closed mekb-turtle closed 5 years ago

mekb-turtle commented 5 years ago

Describe the bug Hi. When I try to build, the path doesn't have any backslashes.

The output says:

C:UsersMyUserDesktopProject does not exist.

To Reproduce Steps to reproduce the behavior:

  1. Use ProcessingTasks.json as .vscode\tasks.json
  2. Build
  3. Output says file path but without the backslashes

Expected behavior Backslashes will be there, with something like: C:\Users\MyUser\Desktop\Project\

VSCode (from Help → About):

AvinZarlez commented 5 years ago

Are you setting processing.path ?

From the readme:

What if you cannot, or do not want to add Processing to your path?

Simply modify the processing.path setting to follow the path to wherever processing is installed on your machine. Be sure to remember to keep the processing-java at the end of the path!

To change settings in VSCode, here is a link to the official documentation.

(Remember, for Windows be sure to turn any "\" into "\\"!)

Single slashes on windows are part of codes, like how "\n" is a new line. "\\" is translated to \ and single slashes are just removed.

mekb-turtle commented 5 years ago

@TobiahZ I have set the path, since I can always press windows+R to open the run dialog, type processing, and it opens.

AvinZarlez commented 5 years ago

If processing is set up in your path (as you said, you can Windows+R and type just processing and it runs) you should NOT set a value to the processing.path VSCode setting.

So when you say "I have set the path" - do you have any value assigned to the processing.path setting? If so, what?

mekb-turtle commented 5 years ago

@TobiahZ Oh, I thought you meant the env %path% variable, but it still works. Anyways, I just realised what you said

Single slashes on Windows are part of codes, like how "\n" is a new line. "\" is translated to \ and single slashes are just removed.

That explains everything!

lucasoeth commented 5 years ago

@TobiahZ Oh, I thought you meant the env %path% variable, but it still works. Anyways, I just realised what you said

Single slashes on Windows are part of codes, like how "\n" is a new line. "\" is translated to \ and single slashes are just removed.

That explains everything!

could I ask how you fixed the problem?

AvinZarlez commented 5 years ago

@lucasoeth I can't speak for @wooden-utensil , but I assume the issue was having single slashes in a file URI.

Example: C:\Users\MyUser\Desktop\Project

However, on Windows, the single backslash character \ is special. It's used to insert special symbols.

Example: This is on line one\nThis is line two would be rendered as:

This is on line one
This is line two

Since a \n is replaced with a new line character.

Single slashes are simply automatically removed if they aren't followed by one of the key letters it's looking for.

Hence why C:\Users\MyUser\Desktop\Project might turn into C:UsersMyUserDesktopProject

Thus, you want to use the special character \\ to create a single backslash.

If you are using the processing.path setting variable on windows, make sure your folder location URI uses double slashes!

mekb-turtle commented 5 years ago

Hang on, I think I was using Bash, but I was somehow using backslashes, so the backslashes get removed.