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.

52 lines
1.8KB

  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> getEntries(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. /** Moves a file. */
  15. void moveFile(const std::string& srcPath, const std::string& destPath);
  16. /** Copies a file. */
  17. void copyFile(const std::string& srcPath, const std::string& destPath);
  18. /** Creates a directory.
  19. The parent directory must exist.
  20. */
  21. void createDirectory(const std::string& path);
  22. /** Returns the number of logical simultaneous multithreading (SMT) (e.g. Intel Hyperthreaded) threads on the CPU. */
  23. int getLogicalCoreCount();
  24. /** Sets a name of the current thread for debuggers and OS-specific process viewers. */
  25. void setThreadName(const std::string& name);
  26. /** Sets the current thread to be high-priority. */
  27. void setThreadRealTime(bool realTime);
  28. /** Returns the caller's human-readable stack trace with "\n"-separated lines. */
  29. std::string getStackTrace();
  30. /** Opens a URL, also happens to work with PDFs and folders.
  31. Shell injection is possible, so make sure the URL is trusted or hard coded.
  32. May block, so open in a new thread.
  33. */
  34. void openBrowser(const std::string& url);
  35. /** Opens Windows Explorer, Finder, etc at the folder location. */
  36. void openFolder(const std::string& path);
  37. /** Runs an executable without blocking.
  38. The launched process will continue running if the current process is closed.
  39. */
  40. void runProcessDetached(const std::string& path);
  41. std::string getOperatingSystemInfo();
  42. } // namespace system
  43. } // namespace rack