diff options
author | louiz’ <louiz@louiz.org> | 2017-04-30 15:04:40 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-04-30 15:14:54 +0200 |
commit | 7b3e0e0cf3eddd3537455a3605b04a48ee663f47 (patch) | |
tree | 06658235b0082b1f173c6114d4aeac2388540297 /src/utils/dirname.cpp | |
parent | 1472adfa77f9c3a03967e723d8460f33544b545d (diff) | |
download | biboumi-7b3e0e0cf3eddd3537455a3605b04a48ee663f47.tar.gz biboumi-7b3e0e0cf3eddd3537455a3605b04a48ee663f47.tar.bz2 biboumi-7b3e0e0cf3eddd3537455a3605b04a48ee663f47.tar.xz biboumi-7b3e0e0cf3eddd3537455a3605b04a48ee663f47.zip |
Make botan’s policy configurable from a file
fix #3244
Diffstat (limited to 'src/utils/dirname.cpp')
-rw-r--r-- | src/utils/dirname.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/dirname.cpp b/src/utils/dirname.cpp new file mode 100644 index 0000000..71c9c38 --- /dev/null +++ b/src/utils/dirname.cpp @@ -0,0 +1,16 @@ +#include <utils/dirname.hpp> + +namespace utils +{ + std::string dirname(const std::string filename) + { + if (filename.empty()) + return "./"; + if (filename == ".." || filename == ".") + return filename; + auto pos = filename.rfind('/'); + if (pos == std::string::npos) + return "./"; + return filename.substr(0, pos + 1); + } +} |