Saving sketch with the same name as a class #196#4033
Saving sketch with the same name as a class #196#4033iamutkarshtiwari wants to merge 1 commit intoprocessing:masterfrom
Conversation
|
Changes made in _build.xml_ on lines-> _631, 778, 1064, 1068. |
|
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. |
|
@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! |
|
@alignedleft Did you test this patch? |
|
@iamutkarshtiwari No, that’s not really my role. I was just voicing support for the idea. |
e35af3e to
ae626ae
Compare
|
@iamutkarshtiwari Some little criticisms: |
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.