Commit 42581035 authored by Orvid King's avatar Orvid King Committed by facebook-github-bot-4

Use .string() not .native() when working with boost::filesystem

Summary: Because .native() produces a wstring under MSVC.
Closes #306

Reviewed By: @yfeldblum

Differential Revision: D2419043

Pulled By: @JoelMarcey
parent f25b0650
......@@ -30,7 +30,7 @@ namespace {
// Guess the program name as basename(executable)
std::string guessProgramName() {
try {
return fs::executable_path().filename().native();
return fs::executable_path().filename().string();
} catch (const std::exception&) {
return "UNKNOWN";
}
......@@ -181,7 +181,7 @@ auto NestedCommandLineApp::findCommand(const std::string& name) const
int NestedCommandLineApp::run(int argc, const char* const argv[]) {
if (programName_.empty()) {
programName_ = fs::path(argv[0]).filename().native();
programName_ = fs::path(argv[0]).filename().string();
}
return run(std::vector<std::string>(argv + 1, argv + argc));
}
......
......@@ -77,7 +77,7 @@ HugePageSizeVec readRawHugePageSizes() {
HugePageSizeVec vec;
fs::path path("/sys/kernel/mm/hugepages");
for (fs::directory_iterator it(path); it != fs::directory_iterator(); ++it) {
std::string filename(it->path().filename().native());
std::string filename(it->path().filename().string());
if (boost::regex_match(filename, match, regex)) {
StringPiece numStr(filename.data() + match.position(1), match.length(1));
vec.emplace_back(to<size_t>(numStr) * 1024);
......@@ -178,7 +178,7 @@ HugePageSizeVec readHugePageSizes() {
// Store mount point
fs::path path(parts[1].begin(), parts[1].end());
struct stat st;
const int ret = stat(path.c_str(), &st);
const int ret = stat(path.string().c_str(), &st);
if (ret == -1 && errno == ENOENT) {
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment