Skip to content

Processing doesn't recognize methods of PApplet when the sketchfolder has a hyphen in it #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
processing-bot opened this issue Nov 29, 2022 · 10 comments

Comments

@processing-bot
Copy link
Collaborator

Created by: mythicaleinhorn

Description

When the name of a sketch folder contains a hyphen, Processing doesn't recognize the methods of PApplet like draw(), background(), etc.
The sketch will compile and run without any problems anyway.

Steps to Reproduce

  1. Create a sketch in a folder with a name containing a hyphen
  2. A sketch.properties file is created pointing to the main file (which can't have a hyphen in it, Processing will refuse to start in that case)
  3. Processing won't recognize the methods of PApplet anymore (draw(), background(), etc.)

Your Environment

  • Processing version: 4.1.1
  • Operating System and OS version: TUXEDO OS 1 (KDE Plasma) / Windows 11
  • Other information: This problem exists since 4.1.0
@processing-bot
Copy link
Collaborator Author

Created by: mythicaleinhorn

Suggested fix:
Adding a check similar to

// Do some checks to make sure the file can be opened, and identify the
// Mode that it's using. (In 4.0b8, this became the fall-through case.)
if (!Sketch.isSanitaryName(pdeFile.getName())) {
Messages.showWarning("You're tricky, but not tricky enough",
pdeFile.getName() + " is not a valid name for sketch code.\n" +
"Better to stick to ASCII, no spaces, and make sure\n" +
"it doesn't start with a number.", null);
return null;
}
to check for hypens in a folder name.

@processing-bot
Copy link
Collaborator Author

Created by: clankill3r

This does not happen on OSX. But it does indeed happen on windows.
The thing is, instead of a "sanitary check", it would be better to find why it breaks with a hyphen and fix that.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

@sampottinger Any quick thoughts? (Not your fault, just that you were in this code recently dealing with incorrect/superficial errors/warnings being reported.)

This is another split between the live error checking and the generated code that's actually run. It looks like there's probably an assumption about class name being the same as the main tab name or the folder name, so this is showing errors when the sketch folder doesn't match up (i.e. it has spaces, hyphens, anything else that's now allowed if you un-check “Keep sketch name and main tab in sync”.

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Weird. Yeah it could be something with the edt edit generation. It's strange that it is OS specific though. I'll take a look.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

I'm seeing it on macOS, I don't think it's OS-specific. To reproduce:

  1. Uncheck the pref to keep sketch name and tab in sync
  2. Do a “Save As” and re-save the sketch to a folder that has spaces or hyphens in the name
  3. You should see red squiggles in the editor area for built-in functions

(i.e. potentially nearby the other bit you had just fixed w/ error squiggles.)

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Here's an example: issue4 0610 hyphen trouble.zip

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Ah I must have misinterpreted an earlier comment. I'll try to take a look tomorrow!

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Actually I think I have a minute let me pop in now @benfry

@processing-bot
Copy link
Collaborator Author

Created by: benfry

All set for 4.1.2 thanks to @sampottinger.

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant