mirror of
https://github.com/ksherlock/mpw.git
synced 2025-02-24 06:29:00 +00:00
don't expand $[a-z]+ in filenames. This was preventing lcc from working properly as it created temporary files named $defout$, etc.
This commit is contained in:
parent
abe8b9236b
commit
fed6e9b172
@ -34,7 +34,7 @@ namespace MPW
|
|||||||
{
|
{
|
||||||
extern std::unordered_map<std::string, std::string> Environment;
|
extern std::unordered_map<std::string, std::string> Environment;
|
||||||
|
|
||||||
std::string ExpandVariables(const std::string &s);
|
std::string ExpandVariables(const std::string &s, bool pathname = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -102,11 +102,17 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# backwards compatibility.
|
# backwards compatibility.
|
||||||
|
# lcc generates temporary files named $xxx$
|
||||||
|
# so don't replace in pathnames.
|
||||||
'$' [A-Za-z0-9_]+ {
|
'$' [A-Za-z0-9_]+ {
|
||||||
std::string name(ts + 1, te);
|
if (pathname) {
|
||||||
auto iter = Environment.find(name);
|
rv.append(ts, te);
|
||||||
if (iter != Environment.end())
|
} else {
|
||||||
rv.append(iter->second);
|
std::string name(ts + 1, te);
|
||||||
|
auto iter = Environment.find(name);
|
||||||
|
if (iter != Environment.end())
|
||||||
|
rv.append(iter->second);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
any {
|
any {
|
||||||
@ -215,7 +221,7 @@ namespace MPW {
|
|||||||
return iter->second;
|
return iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ExpandVariables(const std::string &s)
|
std::string ExpandVariables(const std::string &s, bool pathname)
|
||||||
{
|
{
|
||||||
if (s.find_first_of("{$") == s.npos) return s;
|
if (s.find_first_of("{$") == s.npos) return s;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ namespace MPW {
|
|||||||
std::string RootDirPathForFile(const std::string &file);
|
std::string RootDirPathForFile(const std::string &file);
|
||||||
|
|
||||||
std::string GetEnv(const std::string &);
|
std::string GetEnv(const std::string &);
|
||||||
std::string ExpandVariables(const std::string &s);
|
std::string ExpandVariables(const std::string &s, bool pathname = false);
|
||||||
|
|
||||||
|
|
||||||
// should add argc/argv/envp...
|
// should add argc/argv/envp...
|
||||||
|
@ -127,7 +127,7 @@ namespace ToolBox
|
|||||||
#ifndef TESTING
|
#ifndef TESTING
|
||||||
if (path.find_first_of("${") != path.npos)
|
if (path.find_first_of("${") != path.npos)
|
||||||
{
|
{
|
||||||
path = MPW::ExpandVariables(path);
|
path = MPW::ExpandVariables(path, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user