From 0442690894f918c9d6caf5f4fc9397888b98dcd7 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 9 Sep 2017 10:34:32 +0800 Subject: cfg - Fix handling of `--cfg foo="bar"` --- src/main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f5412228..21e06b0d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -744,11 +744,22 @@ ProgramParams::ProgramParams(int argc, char *argv[]) *p = '\0'; const char* opt = opt_and_val; const char* val = p + 1; + // TODO: Correctly parse the values. + // - Value should be a double-quoted string. if( ::std::strcmp(opt, "feature") == 0 ) { this->features.insert( ::std::string(val) ); } else { - Cfg_SetValue(opt, val); + if( val[0] == '"' ) { + // TODO: Something cleaner than this. + ::std::string s = val+1; + assert(s.back() == '"'); + s.pop_back(); + Cfg_SetValue(opt, s); + } + else { + Cfg_SetValue(opt, val); + } } } else { -- cgit v1.2.3