readFileAsString(): Accept path as boost::filesystem::path instead of string

This commit is contained in:
Kamil Śliwak
2021-08-17 12:58:33 +02:00
parent 790d08f24b
commit cb1a0f08ca
9 changed files with 25 additions and 27 deletions
+3 -5
View File
@@ -35,8 +35,6 @@
#include <libsolutil/CommonData.h>
#include <libsolutil/CommonIO.h>
#include <boost/filesystem.hpp>
#include <iostream>
using namespace std;
@@ -405,12 +403,12 @@ vector<Program> ProgramFactory::build(Options const& _options)
return inputPrograms;
}
CharStream ProgramFactory::loadSource(string const& _sourcePath)
CharStream ProgramFactory::loadSource(boost::filesystem::path const& _sourcePath)
{
assertThrow(boost::filesystem::exists(_sourcePath), MissingFile, "Source file does not exist: " + _sourcePath);
assertThrow(boost::filesystem::exists(_sourcePath), MissingFile, "Source file does not exist: " + _sourcePath.string());
string sourceCode = readFileAsString(_sourcePath);
return CharStream(sourceCode, _sourcePath);
return CharStream(sourceCode, _sourcePath.string());
}
void Phaser::main(int _argc, char** _argv)