Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could remove Rcpp usage entirely from ini_to_core_reader.cpp #695

Open
bpbond opened this issue Feb 4, 2023 · 0 comments
Open

Could remove Rcpp usage entirely from ini_to_core_reader.cpp #695

bpbond opened this issue Feb 4, 2023 · 0 comments
Milestone

Comments

@bpbond
Copy link
Member

bpbond commented Feb 4, 2023

From #692 (comment)

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();
      }

And in Makevars:

CXX_STD = CXX17
@bpbond bpbond added this to the v3.5 milestone Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant