File tree Expand file tree Collapse file tree 5 files changed +48
-0
lines changed Expand file tree Collapse file tree 5 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,18 @@ std::wstring CstringToWstring(const std::string &input) {
381
381
return result;
382
382
}
383
383
384
+ char ** WArgsToCArgs (int argc, wchar_t **wargv) {
385
+ char **argv = new char *[argc];
386
+ for (int i = 0 ; i < argc; i++) {
387
+ std::string arg = WstringToCstring (std::wstring (wargv[i]));
388
+ argv[i] = new char [arg.length ()+1 ];
389
+ for (int j = 0 ; j < arg.length (); j++) {
390
+ argv[i][j] = arg[j];
391
+ }
392
+ argv[i][arg.length ()] = 0 ;
393
+ }
394
+ return argv;
395
+ }
384
396
#endif // defined(_WIN32) || defined(__CYGWIN__)
385
397
386
398
} // namespace blaze_util
Original file line number Diff line number Diff line change @@ -135,6 +135,8 @@ std::string WstringToCstring(const std::wstring &input);
135
135
136
136
// Deprecated. Use AcpToWcs or Utf8ToWcs.
137
137
std::wstring CstringToWstring (const std::string &input);
138
+
139
+ char ** WArgsToCArgs (int argc, wchar_t **wargv);
138
140
#endif // defined(_WIN32) || defined(__CYGWIN__)
139
141
140
142
} // namespace blaze_util
Original file line number Diff line number Diff line change
1
+ load ("@bazel_skylib//rules:build_test.bzl" , "build_test" )
1
2
load ("@rules_cc//cc:cc_binary.bzl" , "cc_binary" )
2
3
load ("@rules_cc//cc:cc_library.bzl" , "cc_library" )
3
4
load ("@rules_cc//cc:cc_test.bzl" , "cc_test" )
@@ -588,3 +589,24 @@ genrule(
588
589
toolchains = ["@rules_java//toolchains:current_java_runtime" ],
589
590
tools = ["@rules_java//toolchains:current_java_runtime" ],
590
591
)
592
+
593
+ build_test (
594
+ name = "singlejar_unicode_filenames_test" ,
595
+ targets = [
596
+ ":gen_singlejar_unicode_filenames" ,
597
+ ],
598
+ )
599
+
600
+ genrule (
601
+ name = "gen_singlejar_unicode_filenames" ,
602
+ outs = [
603
+ "unicode_filenames.jar" ,
604
+ ],
605
+ cmd = """
606
+ touch रैन्डम.txt らんどみ.txt 艾诶艾迪勒开.txt
607
+ $(location :singlejar) --resources रैन्डम.txt らんどみ.txt 艾诶艾迪勒开.txt --output $@
608
+ """ ,
609
+ tools = [
610
+ ":singlejar" ,
611
+ ],
612
+ )
Original file line number Diff line number Diff line change 19
19
#include " src/tools/singlejar/options.h"
20
20
#include " src/tools/singlejar/output_jar.h"
21
21
22
+ #ifdef _WIN32
23
+ #include " src/main/cpp/util/strings.h"
24
+ int wmain (int argc, wchar_t *wargv[]) {
25
+ char **argv = blaze_util::WArgsToCArgs (argc, wargv);
26
+ #else
22
27
int main (int argc, char *argv[]) {
28
+ #endif
23
29
Options options;
24
30
options.ParseCommandLine (argc - 1 , argv + 1 );
25
31
OutputJar output_jar;
Original file line number Diff line number Diff line change 18
18
#include " src/tools/singlejar/options.h"
19
19
#include " src/tools/singlejar/output_jar.h"
20
20
21
+ #ifdef _WIN32
22
+ #include " src/main/cpp/util/strings.h"
23
+ int wmain (int argc, wchar_t *wargv[]) {
24
+ char **argv = blaze_util::WArgsToCArgs (argc, wargv);
25
+ #else
21
26
int main (int argc, char *argv[]) {
27
+ #endif
22
28
Options options;
23
29
options.ParseCommandLine (argc - 1 , argv + 1 );
24
30
OutputJar output_jar;
You can’t perform that action at this time.
0 commit comments