Skip to content

Commit f4fae50

Browse files
Merge branch 'github-205' into 'master'
GitHub 205 -- Allow absolute paths in master input file See merge request qs/ore-github!35
2 parents ac5a901 + 61527a5 commit f4fae50

4 files changed

Lines changed: 58 additions & 65 deletions

File tree

OREAnalytics/orea/app/inputparameters.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
namespace ore {
3535
namespace analytics {
3636

37-
vector<string> getFileNames(const string& fileString, const string& path) {
37+
vector<string> getFileNames(const string& fileString, const std::filesystem::path& path) {
3838
vector<string> fileNames;
3939
boost::split(fileNames, fileString, boost::is_any_of(",;"), boost::token_compress_on);
4040
for (auto it = fileNames.begin(); it < fileNames.end(); it++) {
4141
boost::trim(*it);
42-
*it = path + "/" + *it;
42+
*it = (path / *it).generic_string();
4343
}
4444
return fileNames;
4545
}
@@ -140,7 +140,7 @@ void InputParameters::setPortfolio(const std::string& xml) {
140140
portfolio_->fromXMLString(xml);
141141
}
142142

143-
void InputParameters::setPortfolioFromFile(const std::string& fileNameString, const std::string& inputPath) {
143+
void InputParameters::setPortfolioFromFile(const std::string& fileNameString, const std::filesystem::path& inputPath) {
144144
vector<string> files = getFileNames(fileNameString, inputPath);
145145
portfolio_ = boost::make_shared<Portfolio>(buildFailedTrades_);
146146
for (auto file : files) {

OREAnalytics/orea/app/inputparameters.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
#include <ored/portfolio/portfolio.hpp>
5454
#include <ored/portfolio/referencedata.hpp>
5555
#include <ored/utilities/csvfilereader.hpp>
56+
#include <boost/filesystem/path.hpp>
57+
#include <filesystem>
5658

5759
namespace ore {
5860
namespace analytics {
@@ -92,7 +94,7 @@ class InputParameters {
9294
void setTodaysMarketParams(const std::string& xml);
9395
void setTodaysMarketParamsFromFile(const std::string& fileName);
9496
void setPortfolio(const std::string& xml);
95-
void setPortfolioFromFile(const std::string& fileNameString, const std::string& inputPath);
97+
void setPortfolioFromFile(const std::string& fileNameString, const std::filesystem::path& inputPath);
9698
void setMarketConfigs(const std::map<std::string, std::string>& m);
9799
void setThreads(int i) { nThreads_ = i; }
98100
void setEntireMarket(bool b) { entireMarket_ = b; }
@@ -875,6 +877,7 @@ inline const std::string& InputParameters::marketConfig(const std::string& conte
875877
auto it = marketConfigs_.find(context);
876878
return (it != marketConfigs_.end() ? it->second : Market::defaultConfiguration);
877879
}
880+
std::vector<std::string> getFileNames(const std::string& fileString, const std::filesystem::path& path);
878881

879882
//! Traditional ORE input via ore.xml and various files, output into files
880883
class OutputParameters {

0 commit comments

Comments
 (0)