1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 13:25:45 +02:00
bees/lib/path.cc
2016-11-17 12:12:13 -05:00

27 lines
435 B
C++

#include "crucible/path.h"
#include "crucible/error.h"
namespace crucible {
using namespace std;
string
basename(string s)
{
size_t left = s.find_last_of("/");
size_t right = s.find_last_not_of("/");
if (left == string::npos) {
return s;
}
return s.substr(left + 1, right);
}
string
join(string dir, string base)
{
// TODO: a lot of sanity checking, maybe canonicalization
return dir + "/" + base;
}
};