Connect++ 0.5.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
PathUtilities.cpp
1/*
2
3Copyright © 2023-24 Sean Holden. All rights reserved.
4
5*/
6/*
7
8This file is part of Connect++.
9
10Connect++ is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License as published by the
12Free Software Foundation, either version 3 of the License, or (at your
13option) any later version.
14
15Connect++ is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18more details.
19
20You should have received a copy of the GNU General Public License along
21with Connect++. If not, see <https://www.gnu.org/licenses/>.
22
23*/
24
25#include "PathUtilities.hpp"
26
27namespace path_utilities {
39 fs::path insert_count_in_path(fs::path input_path, uint32_t count) {
40 if (input_path.has_filename()) {
41 fs::path stem = input_path.stem();
42 fs::path extension = input_path.extension();
43 fs::path count_as_path(std::to_string(count));
44 stem += count_as_path;
45 stem += extension;
46 input_path.replace_filename(stem);
47 }
48 return input_path;
49 }
50}