options-processing.h 1017 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef DINIT_OPTIONS_PROCESSING_H
  2. #define DINIT_OPTIONS_PROCESSING_H 1
  3. #include <vector>
  4. #include <service-dir.h>
  5. class service_dir_opt
  6. {
  7. std::vector<const char *> service_dirs;
  8. static const char *user_home_path;
  9. service_dir_pathlist service_dir_paths;
  10. public:
  11. // Get user home (and set user_home_path). (The return may become invalid after
  12. // changing the environment (HOME variable) or using the getpwuid() function).
  13. static const char * get_user_home();
  14. void set_specified_service_dir(const char *specified_dir)
  15. {
  16. service_dirs.push_back(specified_dir);
  17. }
  18. // Build the set of service directory paths, as per configuration specified thus far. This might be a
  19. // single specified path, or a set of default paths.
  20. void build_paths(bool am_system_init);
  21. // Get the service directory paths as a (mutable) collection. Call only after calling build_paths().
  22. service_dir_pathlist &get_paths()
  23. {
  24. return service_dir_paths;
  25. }
  26. };
  27. #endif