Browse Source

formatting only / doc

LIB-18
heck 4 years ago
parent
commit
cbdc72995e
  1. 6
      src/std_utils.cc
  2. 2
      src/std_utils.hh

6
src/std_utils.cc

@ -101,7 +101,7 @@ namespace pEp {
} }
} }
std::string path_dirname(std::string const& f) std::string path_dirname(std::string const &f)
{ {
if (f.empty()) if (f.empty())
return f; return f;
@ -123,12 +123,12 @@ namespace pEp {
return std::string(f.c_str(), len); return std::string(f.c_str(), len);
} }
std::string path_get_abs(const std::string& path) std::string path_get_abs(const std::string &path)
{ {
std::string ret{ path }; std::string ret{ path };
if (path[0] != '/') { if (path[0] != '/') {
char cwd[2048]; char cwd[2048];
char const* res = getcwd(cwd, sizeof(cwd)); char const *res = getcwd(cwd, sizeof(cwd));
if (res == nullptr) { if (res == nullptr) {
throw std::runtime_error( throw std::runtime_error(
"failed to get current working directory: " + std::string(strerror(errno))); "failed to get current working directory: " + std::string(strerror(errno)));

2
src/std_utils.hh

@ -65,7 +65,7 @@ namespace pEp {
std::vector<std::string> dir_list_files(const std::string &dirname); std::vector<std::string> dir_list_files(const std::string &dirname);
#endif #endif
//String formatting //String tools
std::string padTo(const std::string &str, const size_t num, const char paddingChar); std::string padTo(const std::string &str, const size_t num, const char paddingChar);
std::string clip(const std::string &str, const size_t len); std::string clip(const std::string &str, const size_t len);
std::string tldr(const std::string &str, const size_t len); std::string tldr(const std::string &str, const size_t len);

Loading…
Cancel
Save