Skip to content
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

Saving sketch with the same name as a class #196 #4033

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iamutkarshtiwari
Copy link
Contributor

This patch is fix to the issue -> #196, #305

I have generated a list of all the possible reserved keywords( in Processing and Java language) in a _"reservedKeywords.txt"_ file in _build/shared/_ (which will be later copied to build/linux/work/ during setup build) folder through a script(https://github.com/iamutkarshtiwari/ReservedWordsGenerator). Whenever the user will save a sketch with a new name, _sanitizeName()_ will search for that name in 'reservedKeywords.txt" file. If the name exist in that file, it will prompt the user to save with any another filename but inbuilt class name.

@iamutkarshtiwari
Copy link
Contributor Author

Changes made in _build.xml_ on lines-> _631, 778, 1064, 1068.
I also cleaned up a lot of trailing whitespaces in _build.xml
file.

@iamutkarshtiwari
Copy link
Contributor Author

You may test this patch by saving the sketch with any _Processing class names_ (like _PImage, PApplet, PSurfaceNone, etc) or with _reserved Keywords(like _abstract, int, long, boolean, etc_) in Java.

@scotthmurray
Copy link
Member

@iamutkarshtiwari This is a needed feature. I stumbled on this the other day, unintentionally saving a sketch using a name of an existing class or method. I don't remember the specific outcome, but things went haywire. Thanks for looking at this!

@iamutkarshtiwari
Copy link
Contributor Author

@alignedleft Did you test this patch?

@scotthmurray
Copy link
Member

@iamutkarshtiwari No, that’s not really my role. I was just voicing support for the idea.

@GKFX
Copy link
Contributor

GKFX commented Apr 12, 2016

@iamutkarshtiwari Some little criticisms:
Why are keywords from processing.app reserved? I tested a sketch called CopyAsHtmlAction (without applying your patch) and it runs fine.
There's a space missing before the bracket in Name '%s' is a not allowed(reserved keyword).
You've forgotten to close or try-with-resources your FileReader and BufferedReader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants