diff options
author | Jose <jose@zeroc.com> | 2016-09-17 00:28:00 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-09-17 00:28:00 +0200 |
commit | 47c3b5d2b03d3286cba2a3b4890e57fdd6135132 (patch) | |
tree | 40e05ffec6df92a5b88fdb675d775580f41547c1 /cpp/src/slice2confluence/Main.cpp | |
parent | 3.6.3 version fixes (diff) | |
download | ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.bz2 ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.tar.xz ice-47c3b5d2b03d3286cba2a3b4890e57fdd6135132.zip |
Fix ICE-4787 - slice compilers and unicode paths
Diffstat (limited to 'cpp/src/slice2confluence/Main.cpp')
-rw-r--r-- | cpp/src/slice2confluence/Main.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/cpp/src/slice2confluence/Main.cpp b/cpp/src/slice2confluence/Main.cpp index 469b8984588..86dec9e4d54 100644 --- a/cpp/src/slice2confluence/Main.cpp +++ b/cpp/src/slice2confluence/Main.cpp @@ -78,7 +78,7 @@ interruptedCallback(int signal) } void -usage(const char* n) +usage(const string& n) { getErrorStream() << "Usage: " << n << " [options] slice-files...\n"; getErrorStream() << @@ -109,7 +109,7 @@ usage(const char* n) } int -compile(int argc, char* argv[]) +compile(const vector<string>& argv) { IceUtilInternal::Options opts; opts.addOpt("h", "help"); @@ -134,20 +134,11 @@ compile(int argc, char* argv[]) opts.addOpt("", "ice"); opts.addOpt("", "underscore"); - bool validate = false; - for(int i = 0; i < argc; ++i) - { - if(string(argv[i]) == "--validate") - { - validate = true; - break; - } - } - + bool validate = find(argv.begin(), argv.end(), "--validate") != argv.end(); vector<string> args; try { - args = opts.parse(argc, (const char**)argv); + args = opts.parse(argv); } catch(const IceUtilInternal::BadOptException& e) { @@ -364,31 +355,35 @@ compile(int argc, char* argv[]) return status; } -int -main(int argc, char* argv[]) +#ifdef _WIN32 +int wmain(int argc, wchar_t* argv[]) +#else +int main(int argc, char* argv[]) +#endif { + vector<string> args = Slice::argvToArgs(argc, argv); try { - return compile(argc, argv); + return compile(args); } catch(const std::exception& ex) { - getErrorStream() << argv[0] << ": error:" << ex.what() << endl; + getErrorStream() << args[0] << ": error:" << ex.what() << endl; return EXIT_FAILURE; } catch(const std::string& msg) { - getErrorStream() << argv[0] << ": error:" << msg << endl; + getErrorStream() << args[0] << ": error:" << msg << endl; return EXIT_FAILURE; } catch(const char* msg) { - getErrorStream() << argv[0] << ": error:" << msg << endl; + getErrorStream() << args[0] << ": error:" << msg << endl; return EXIT_FAILURE; } catch(...) { - getErrorStream() << argv[0] << ": error:" << "unknown exception" << endl; + getErrorStream() << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } |