Repository navigation
Conversation
|
If I were doing this on a Linux box I'd just write |
|
Maybe. I think, not. The main problem is the command line / shell environment on Windows. If those programs you mention exists on Windows, they'll still use the non-Unicode ... shell thing. If I'm not missing something, it would still not work. See the String expected = "ℕ.java";
String actual = "N.java"And this is a good (human-readable) guess -- almost all other Unicode characters are translated to |
| Path path = Paths.get(value); | ||
| try { | ||
| for (String line : Files.readAllLines(path, StandardCharsets.UTF_8)) { | ||
| line = line.trim(); |
There was a problem hiding this comment.
I wonder if this line would be less bug-prone if it were replaced with CharMatcher.whitespace().trimFrom(line).
|
What do you think about supporting javac-style |
|
In progress... |
|
Ah, with escaping. Check. |
|
Expand the "args" in I go with the second option for an initial PR. |
|
Ready for review. |
cushon
left a comment
There was a problem hiding this comment.
LGTM aside from a couple of minor questions.
|
|
||
| @Test | ||
| // https://stackoverflow.com/questions/7660651/passing-command-line-unicode-argument-to-java-code | ||
| public void testMainWithUnicodeArgumentFailsOnWindows() throws Exception { |
There was a problem hiding this comment.
Did you want to include this test, or was it more to document the problem? I guess it would provide some notice if this changed?
There was a problem hiding this comment.
It only demonstrates the underlying issue why I needed that --sourceFile feature.
I think, it's superseded by now and I'll remove it from this PR.
| CommandLineOptions options = | ||
| CommandLineOptionsParser.parse(Arrays.asList("@" + path.toString())); | ||
| assertThat(options.files()).containsExactly("Hello.java", "ℕ.java", "Goodbye.java"); | ||
| } |
There was a problem hiding this comment.
Can you also test non-params file arguments before/after the params file, the @@-escape syntax, and maybe a nested params file?
|
Should we also support comment lines? Meaning ignore lines that start with |
|
Almost down to a single feature branch. :) |
This PR adds support for javac-style @params files.
Example:
@params.txt:This solves two problems with current command line program:
params.txtmay contain Unicode source file names. See https://stackoverflow.com/questions/7660651/passing-command-line-unicode-argument-to-java-code