mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
27 lines
435 B
C++
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;
|
|
}
|
|
|
|
};
|