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.

12345678910111213141516171819202122232425262728293031323334
  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. FileInfo fileInfo(const std::string &path);
  16. bool fileExists(const std::string &path);
  17. void mkdirp(const std::string &path);
  18. void rmrf(const std::string &path);
  19. void execute(const std::vector<std::string> &args, std::string *output, bool print);
  20. void readDir(const std::string &path, std::vector<std::string> &files);
  21. void chdir(const std::string &path);
  22. std::string cwd();
  23. void symlink(const std::string &from, const std::string &to);
  24. std::string dirname(const std::string &path);
  25. std::ofstream ofstream(const std::string &path);
  26. std::ifstream ifstream(const std::string &path);
  27. }