Václav Kubernát | 94938b7 | 2018-05-04 15:12:24 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
| 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
| 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
| 7 | */ |
| 8 | #include "utils.hpp" |
| 9 | |
| 10 | std::string joinPaths(const std::string& prefix, const std::string& suffix) |
| 11 | { |
| 12 | if (prefix.empty() || suffix.empty()) |
| 13 | return prefix + suffix; |
| 14 | else |
| 15 | return prefix + '/' + suffix; |
| 16 | } |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 17 | |
| 18 | std::string stripLastNodeFromPath(const std::string& path) |
| 19 | { |
| 20 | std::string res = path; |
| 21 | auto pos = res.find_last_of('/'); |
| 22 | if (pos == res.npos) |
| 23 | res.clear(); |
| 24 | else |
| 25 | res.erase(pos); |
| 26 | return res; |
| 27 | } |