Build tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sys.h 817B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include <string>
  3. #include <vector>
  4. #include <fstream>
  5. namespace sys {
  6. struct FileInfo {
  7. long mTimeSec;
  8. long mTimeNsec;
  9. bool isDir;
  10. bool isOlderThan(FileInfo &f) {
  11. return mTimeSec < f.mTimeSec ||
  12. (mTimeSec == f.mTimeSec && mTimeNsec < f.mTimeNsec);
  13. }
  14. };
  15. std::string sanitizePath(const std::string &path);
  16. FileInfo fileInfo(const std::string &path);
  17. bool fileExists(const std::string &path);
  18. void mkdirp(const std::string &path);
  19. void rmrf(const std::string &path);
  20. void execute(const std::vector<std::string> &args, std::string *output, bool print);
  21. void readDir(const std::string &path, std::vector<std::string> &files);
  22. void chdir(const std::string &path);
  23. std::string cwd();
  24. void symlink(const std::string &from, const std::string &to);
  25. std::string dirname(const std::string &path);
  26. }