Skip to content

Commit

Permalink
Fix issue Andersbakken#597. Make unquote work with single quotes as w…
Browse files Browse the repository at this point in the history
…ell.
  • Loading branch information
Andersbakken committed Feb 24, 2016
1 parent 1ab3f52 commit a4d349e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static inline bool hasValue(const String &arg)
return false;
}

static inline bool isBlacklisted(const String& arg)
static inline bool isBlacklisted(const String &arg)
{
for (int i = 0; blacklist[i]; ++i) {
if (arg == blacklist[i])
Expand All @@ -271,12 +271,14 @@ static inline bool isBlacklisted(const String& arg)
return false;
}

static inline String unquote(const String& arg)
static inline String unquote(const String &arg)
{
if (arg.size() >= 4 && arg.startsWith("\\\"") && arg.endsWith("\\\"")) {
return arg.mid(1, arg.size() - 3) + '\"';
} else if (arg.size() >= 2 && arg.startsWith('"') && arg.endsWith('"')) {
return arg.mid(1, arg.size() - 2);
} else if (arg.size() >= 2 && arg.startsWith('\'') && arg.endsWith('\'')) {
return arg.mid(1, arg.size() - 2);
}
return arg;
}
Expand Down

0 comments on commit a4d349e

Please sign in to comment.