mirror of https://github.com/djcb/mu.git
utils: small tweaks
This commit is contained in:
parent
c4a141975e
commit
e1308a9b40
|
@ -130,12 +130,17 @@ struct TempDir {
|
|||
*
|
||||
* @return the path.
|
||||
*/
|
||||
const std::string& path() {return path_; }
|
||||
const std::string& path() const { return path_; }
|
||||
private:
|
||||
std::string path_;
|
||||
const bool autodelete_;
|
||||
};
|
||||
|
||||
static inline auto format_as(const TempDir& td) {
|
||||
return td.path();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Temporary (RAII) timezone
|
||||
*/
|
||||
|
|
|
@ -289,6 +289,13 @@ Mu::run_command(std::initializer_list<std::string> args)
|
|||
argvec.push_back(g_strdup(arg.c_str()));
|
||||
argvec.push_back({});
|
||||
|
||||
{
|
||||
std::vector<std::string> qargs{};
|
||||
for(auto&& arg: args)
|
||||
qargs.emplace_back("'" + arg + "'");
|
||||
mu_debug("run-command: {}", fmt::join(qargs, " "));
|
||||
}
|
||||
|
||||
GError *err{};
|
||||
int wait_status{};
|
||||
gchar *std_out{}, *std_err{};
|
||||
|
|
|
@ -145,7 +145,7 @@ auto mu_join(Range&& range, std::string_view sepa) {
|
|||
return fmt::join(std::forward<Range>(range), sepa);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T=::time_t>
|
||||
std::tm mu_time(T t={}, bool use_utc=false) {
|
||||
::time_t tt{static_cast<::time_t>(t)};
|
||||
return use_utc ? fmt::gmtime(tt) : fmt::localtime(tt);
|
||||
|
|
Loading…
Reference in New Issue