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.

44 lines
1.4KB

  1. #pragma once
  2. #include "common.hpp"
  3. #include <list>
  4. namespace rack {
  5. /** Cross-platform functions for operating systems routines
  6. */
  7. namespace system {
  8. /** Returns a list of all entries (directories, files, symbols) in a directory. */
  9. std::list<std::string> listEntries(const std::string &path);
  10. /** Returns whether the given path is a file. */
  11. bool isFile(const std::string &path);
  12. /** Returns whether the given path is a directory. */
  13. bool isDirectory(const std::string &path);
  14. /** Copies a file. */
  15. void copyFile(const std::string &srcPath, const std::string &destPath);
  16. /** Creates a directory.
  17. The parent directory must exist.
  18. */
  19. void createDirectory(const std::string &path);
  20. /** Returns the number of logical simultaneous multithreading (SMT) (e.g. Intel Hyperthreaded) threads on the CPU. */
  21. int getLogicalCoreCount();
  22. /** Sets a name of the current thread for debuggers and OS-specific process viewers. */
  23. void setThreadName(const std::string &name);
  24. /** Sets the current thread to be high-priority. */
  25. void setThreadRealTime();
  26. /** Returns the caller's human-readable stack trace with "\n"-separated lines. */
  27. std::string getStackTrace();
  28. /** Opens a URL, also happens to work with PDFs and folders.
  29. Shell injection is possible, so make sure the URL is trusted or hard coded.
  30. May block, so open in a new thread.
  31. */
  32. void openBrowser(const std::string &url);
  33. void openFolder(const std::string &path);
  34. } // namespace system
  35. } // namespace rack