mirror of
https://github.com/Zygo/bees.git
synced 2025-06-16 17:46:16 +02:00
bees: remove local cruft, throw at github
This commit is contained in:
26
lib/path.cc
Normal file
26
lib/path.cc
Normal file
@ -0,0 +1,26 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
};
|
Reference in New Issue
Block a user