Ensure dump file names do not contain special characters
When TargetID is supported, the isa name will contain ':' characters that are not legal in Windows file names. So replace all non-aphanumeric or '+'/'-' characters with '_' to ensure the file name will be legal on any file system. Change-Id: I0b73a6188c186f75f1d2e8af19ade87667cbfe0b
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <cassert>
|
||||
#include <regex>
|
||||
#include "options.hpp"
|
||||
|
||||
namespace {
|
||||
@@ -1552,7 +1553,9 @@ Options::setDumpFileName(const char* val)
|
||||
}
|
||||
|
||||
std::stringstream prefix;
|
||||
prefix << dumpPrefix << "_" << buildNo << "_" << val;
|
||||
// Replace characters in the file name that are not legal with '_'.
|
||||
prefix << dumpPrefix << "_" << buildNo << "_"
|
||||
<< std::regex_replace(val, std::regex("[:]"), "_");
|
||||
dumpFileRoot = prefix.str();
|
||||
|
||||
// Check whether the length of path meets the system limits
|
||||
|
||||
Reference in New Issue
Block a user