Commit e523a4d5 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

cleaning up

parent 3bf4457d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ public:
  }

  void testOpenFile() {
    auto csv_file = CSVFile::openFile("test/fixtures/gbp_per_country");
    auto csv_file = CSVFile::openFile("test/fixtures/gbp_per_country.csv");
    assert(csv_file.get() != nullptr);
    assert(csv_file->fd_ > 0);
  }
+3 −2
Original line number Diff line number Diff line
@@ -13,13 +13,14 @@ namespace fnordmetric {
namespace csv_backend {

std::unique_ptr<CSVFile> CSVFile::openFile(const std::string& file_path) {
  int fd = open(file_path.c_str(), O_RDONLY);
  auto fp = file_path.c_str();
  int fd = open(fp, O_RDONLY);

  if (fd < 1) {
    throw RUNTIME_EXCEPTION_ERRNO(
        ERR_CANNOT_OPEN_FILE,
        "error opening file '%s'",
        file_path.c_str());
        fp);
  }

  auto csv_file = new CSVFile(fd);