Even simpler would be to rip out Rcpp usage entirely in this file, and just depend on std::filesystem! I couldn't quite get this to work — see #694 — but enough already, closing that PR but will open an issue for the future.
For the record, my code in #694 looked like this in ini_to_core_reader.cpp:
// Whether using the R package or building standalone Hector,
// use std::filesystem (which is available since the C++ 17 standard)
// if available; otherwise fall back to boost::filesystem (which
// needs to be installed).
#if __cpp_lib_filesystem || __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
(and down below)
// If the given path (absolute or relative) points to a file
// that exists, use that. Otherwise, assume that the path
// is relative to the INI file's directory.
fs::path csvFilePath(csvFileName);
if (!fs::exists(csvFilePath)) {
fs::path iniFilePath(reader->iniFilePath);
fs::path fullPath(iniFilePath.parent_path() / csvFilePath);
csvFileName = fullPath.string();
}
From https://github.com/JGCRI/hector/issues/692#issuecomment-1416869721
For the record, my code in #694 looked like this in
ini_to_core_reader.cpp
:And in
Makevars
: