|
1234567891011121314151617181920212223242526272829303132333435363738 |
- #pragma once
-
- #include <string>
- #include <vector>
- #include <fstream>
-
- namespace sys {
-
- struct FileInfo {
- long mTimeSec;
- long mTimeNsec;
- bool isDir;
-
- bool isOlderThan(FileInfo &f) {
- return mTimeSec < f.mTimeSec ||
- (mTimeSec == f.mTimeSec && mTimeNsec < f.mTimeNsec);
- }
- };
-
- struct ProcConf {
- bool print = false;
- bool forwardSignals = false;
- std::string *output = nullptr;
- };
-
- std::string sanitizePath(const std::string &path);
- FileInfo fileInfo(const std::string &path);
- bool fileExists(const std::string &path);
- void mkdirp(const std::string &path);
- void rmrf(const std::string &path);
- void execute(const std::vector<std::string> &args, const ProcConf &conf);
- void readDir(const std::string &path, std::vector<std::string> &files);
- void chdir(const std::string &path);
- std::string cwd();
- void symlink(const std::string &from, const std::string &to);
- std::string dirname(const std::string &path);
-
- }
|