From 31d6253beb7913cc2fb54a247b3d54631fd89ae7 Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Fri, 20 Oct 2023 06:08:42 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- include/resource_data.h | 2 +- src/cmd_parser.cpp | 12 ++++++------ src/config_parser.cpp | 3 ++- src/i_resource_compiler.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/resource_data.h b/include/resource_data.h index c57d56c..b22511d 100644 --- a/include/resource_data.h +++ b/include/resource_data.h @@ -39,7 +39,7 @@ const static std::string LONG_PATH_HEAD = "\\\\?\\"; const static std::string ID_DEFINED_INDENTATION = " "; const static int32_t VERSION_MAX_LEN = 128; const static int32_t INT_TO_BYTES = sizeof(uint32_t); -static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 4.101" }; +static const int8_t RESTOOL_VERSION[VERSION_MAX_LEN] = { "Restool 4.102" }; const static int32_t TAG_LEN = 4; enum class KeyType { diff --git a/src/cmd_parser.cpp b/src/cmd_parser.cpp index 1f6d242..6d2e4f7 100644 --- a/src/cmd_parser.cpp +++ b/src/cmd_parser.cpp @@ -392,7 +392,7 @@ uint32_t PackageParser::HandleProcess(int c, const string& argValue) { auto handler = handles_.find(c); if (handler == handles_.end()) { - cout << "Error: unsupport " << c << endl; + cerr << "Error: unsupport " << c << endl; return RESTOOL_ERROR; } return handler->second(argValue); @@ -420,7 +420,7 @@ uint32_t PackageParser::ParseCommand(int argc, char *argv[]) if (optIndex != -1) { string curOpt = (optarg == nullptr) ? argv[optind - 1] : argv[optind - 2]; if (curOpt != ("--" + string(CMD_OPTS[optIndex].name))) { - cout << "Error: unknown option " << curOpt << endl; + cerr << "Error: unknown option " << curOpt << endl; return RESTOOL_ERROR; } } @@ -432,19 +432,19 @@ uint32_t PackageParser::ParseCommand(int argc, char *argv[]) for (int i = optind; i < argc; i++) { errmsg.append(argv[i]).append(" "); } - cout << errmsg << endl; + cerr << errmsg << endl; return RESTOOL_ERROR; } if (c == Option::UNKNOWN) { string optUnknown = (optopt == 0) ? argv[optind - 1] : ("-" + string(1, optopt)); - cout << "Error: unknown option " << optUnknown << endl; + cerr << "Error: unknown option " << optUnknown << endl; return RESTOOL_ERROR; } if (c == Option::NO_ARGUMENT) { if (IsLongOpt(argv)) { - cout << "Error: option " << argv[optind - 1] << " must have argument" << endl; + cerr << "Error: option " << argv[optind - 1] << " must have argument" << endl; } else { - cout << "Error: unknown option " << argv[optind - 1] << endl; + cerr << "Error: unknown option " << argv[optind - 1] << endl; } return RESTOOL_ERROR; } diff --git a/src/config_parser.cpp b/src/config_parser.cpp index 984bb76..c670637 100644 --- a/src/config_parser.cpp +++ b/src/config_parser.cpp @@ -39,7 +39,8 @@ const map ConfigParser::JSON_STRING_IDS = { { "startWindowIcon", "^\\$media:" }, { "startWindowBackground", "^\\$color:"}, { "resource", "^\\$[a-z]+:" }, - { "extra", "^\\$[a-z]+:" } + { "extra", "^\\$[a-z]+:" }, + { "fileContextMenu", "^\\profile:" } }; const map ConfigParser::JSON_ARRAY_IDS = { diff --git a/src/i_resource_compiler.cpp b/src/i_resource_compiler.cpp index a3e2c03..cab2f7c 100644 --- a/src/i_resource_compiler.cpp +++ b/src/i_resource_compiler.cpp @@ -52,7 +52,7 @@ uint32_t IResourceCompiler::Compile(const vector &directoryInfos) } if (!it->IsFile()) { - cout << "Error: '" << it->GetFilePath().GetPath() << "' must be a file." << endl; + cerr << "Error: '" << it->GetFilePath().GetPath() << "' must be a file." << endl; return RESTOOL_ERROR; }