From f32b6076ea29de54d1d63b1b2a0d351773820c13 Mon Sep 17 00:00:00 2001 From: Oliver Schubert <o.schubert@tum.de> Date: Wed, 18 Dec 2024 16:12:22 +0100 Subject: [PATCH] Adds <filesystem> library for testing purposes. --- DesignEvaluator/src/main.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/DesignEvaluator/src/main.cpp b/DesignEvaluator/src/main.cpp index 4db511bf..74c87917 100644 --- a/DesignEvaluator/src/main.cpp +++ b/DesignEvaluator/src/main.cpp @@ -1,13 +1,33 @@ #include <iostream> +#include <filesystem> #include <boost/property_tree/xml_parser.hpp> #include <boost/property_tree/ptree.hpp> int main () { - boost::property_tree::ptree tree1, tree2; + std::filesystem::path upstream_file("./test-upstream-files/oldFormat-CSR.xml"); + std::filesystem::path local_file("./projects/oldFormat-CSR.xml"); + boost::property_tree::ptree upstream_tree, local_tree; + + // Checking path properties + if (std::filesystem::exists(upstream_file)) { + std::cout << "File exists" << std::endl; + } + + if (std::filesystem::exists(local_file)) { + std::cout << "File exists" << std::endl; + } + + // Accessing path components + std::cout << upstream_file.root_name() << std::endl; + std::cout << upstream_file.parent_path() << std::endl; + std::cout << upstream_file.filename() << std::endl; + std::cout << upstream_file.extension() << std::endl; + try { - boost::property_tree::read_xml("oldFormat-CSR.xml", tree1); + boost::property_tree::read_xml(upstream_file.string(), upstream_tree); + boost::property_tree::read_xml(local_file.string(), local_tree); } catch(const std::exception& e) { -- GitLab