37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace ddkit {
|
|
namespace utils {
|
|
namespace system {
|
|
|
|
void sleep(int secs); // sleep seconds (instead of unix-sleep)
|
|
void msSleep(int milliSecs); // sleep milliseconds (instead of unix-sleep)
|
|
std::string getEnv(const std::string& var);
|
|
std::string getEnv(const std::string& var, const std::string& defaultVal);
|
|
bool setEnv(const std::string& name, const std::string& value);
|
|
std::string dirname(std::string text); // "path/to/file.cpp" -> "path/to/"
|
|
std::string filename(std::string text); // "path/to/file.cpp" -> "file" / "path/to/file.hpp" -> "file.hpp"
|
|
std::string filenameBase(std::string text); // "path/to/file.xyz" -> "file.cpp" -> "file"
|
|
int getProcessId();
|
|
std::string getProcessName(); // "some_name"
|
|
std::string getProcessNameWithPath(); // "/user/local/bin/some_name.exe"
|
|
std::string getHostname();
|
|
|
|
std::string threadIdCurrent();
|
|
|
|
void blockSignals(); // blocks SIGINT/SIGHUP/SIGKILL for current thread. does nothing on windows
|
|
void waitForSignal(); // waits for SIGINT/SIGHUP/SIGKILL, or windows ctrl-c
|
|
|
|
bool isFileReadable(const std::string& filename); // does a file exist and does open succeed?
|
|
bool renameFile(const std::string& oldName, const std::string& newName);
|
|
bool deleteFile(const std::string& name);
|
|
void setNativeThreadName(const std::string& name);
|
|
std::string getNativeThreadName();
|
|
|
|
} // namespace system
|
|
} // namespace utils
|
|
} // namespace ddkit
|