Fix substituion
This commit is contained in:
parent
e5c008b55a
commit
38369f10dd
|
@ -56,7 +56,7 @@ int PW_MAIN(int argc, const CharType* argv[], const CharType* envp[]) {
|
|||
<< ToUtf8(subst) << "\".\n";
|
||||
return -1;
|
||||
}
|
||||
System::StrType value = subst.substr(equal_pos, subst.size());
|
||||
System::StrType value = subst.substr(equal_pos + 1, subst.size());
|
||||
if (value == PW_SYS_STR("${pwd}")) {
|
||||
value = System::GetWorkingDirectory();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void basic_part2_test(std::string current_dir, const char* envp[]) {
|
|||
}
|
||||
|
||||
void subst_pwd_test(std::string current_dir, const char* envp[]) {
|
||||
if (current_dir == "${pwd}") {
|
||||
if (current_dir.find("${pwd}") != std::string::npos) {
|
||||
std::cerr << "error: argument ${pwd} substitution failed.\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ void subst_pwd_test(std::string current_dir, const char* envp[]) {
|
|||
const std::string env = envp[i];
|
||||
if (env.rfind("CURRENT_DIR", 0) == 0) {
|
||||
found = true;
|
||||
if (env.find("${pwd}") == 0) {
|
||||
if (env.find("${pwd}") != std::string::npos) {
|
||||
std::cerr << "error: environment variable ${pwd} substitution failed.\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue