Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: runtime/bin/main.cc

Issue 2084553003: Better command line error messages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 6c8ca4b2a23e5a5a3d1af7a9193603a0fe1906a5..d7bfb3b963c9bbf5137022514a9aaad2e26d9f59 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -207,7 +207,7 @@ static bool ProcessVerboseOption(const char* arg,
static bool ProcessPackageRootOption(const char* arg,
CommandLineOptions* vm_options) {
ASSERT(arg != NULL);
- if (*arg == '\0' || *arg == '-') {
+ if (*arg == '-') {
return false;
}
commandline_package_root = arg;
@@ -216,9 +216,9 @@ static bool ProcessPackageRootOption(const char* arg,
static bool ProcessPackagesOption(const char* arg,
- CommandLineOptions* vm_options) {
+ CommandLineOptions* vm_options) {
ASSERT(arg != NULL);
- if ((*arg == '\0') || (*arg == '-')) {
+ if (*arg == '-') {
return false;
}
commandline_packages_file = arg;
@@ -592,6 +592,16 @@ static int ParseArguments(int argc,
"file is invalid.\n");
return -1;
}
+ if ((commandline_package_root != NULL) &&
+ (strlen(commandline_package_root) == 0)) {
+ Log::PrintErr("Empty package root specified.\n");
+ return -1;
+ }
+ if ((commandline_packages_file != NULL) &&
+ (strlen(commandline_packages_file) == 0)) {
+ Log::PrintErr("Empty package file name specified.\n");
+ return -1;
+ }
if (is_noopt && gen_snapshot_kind != kNone) {
Log::PrintErr("Generating a snapshot with dart_noopt is invalid.\n");
return -1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698