-
-
Notifications
You must be signed in to change notification settings - Fork 336
Quote schematic file names in //schem list #3445
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -542,4 +542,19 @@ public static boolean containsUuid(String str) { | |
| return UUID_PATTERN.matcher(str).find(); | ||
| } | ||
|
|
||
| public static String escape(String value) { | ||
| if (value.isEmpty()) { | ||
| return "\"\""; | ||
| } | ||
|
Comment on lines
+546
to
+548
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to handle an empty string like that? |
||
|
|
||
| boolean quote = value.indexOf(' ') >= 0 || value.indexOf('\t') >= 0; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the idea behind including |
||
| if (!quote) { | ||
| return value; | ||
| } | ||
|
|
||
| String escaped = value.replace("\\", "\\\\").replace("\"", "\\\""); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the intention behind this? It doesn't seem like Piston can deal with |
||
|
|
||
| return "\"" + escaped + "\""; | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should have documentation describing its behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not going to make any more changes to this, it’s a tiny merge to fix an annoyance I had- didn’t really intend on coming back in three weeks😭. I can move this it an issue instead if that’s better. Maintainer edits are also on.