| 108 | } |
| 109 | |
| 110 | std::vector<std::string> wf::config_backend_t::get_xml_dirs() const |
| 111 | { |
| 112 | std::vector<std::string> xmldirs; |
| 113 | namespace fs = std::filesystem; |
| 114 | |
| 115 | if (char *plugin_xml_path = getenv("WAYFIRE_PLUGIN_XML_PATH")) |
| 116 | { |
| 117 | std::stringstream ss(plugin_xml_path); |
| 118 | std::string entry; |
| 119 | while (std::getline(ss, entry, ':')) |
| 120 | { |
| 121 | xmldirs.push_back(entry); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | // also add XDG specific paths |
| 126 | fs::path xdg_data_dir; |
| 127 | if (char *c_xdg_data_dir = std::getenv("XDG_DATA_HOME")) |
| 128 | { |
| 129 | xdg_data_dir = fs::path(c_xdg_data_dir); |
| 130 | } else if (char *c_user_home = std::getenv("HOME")) |
| 131 | { |
| 132 | xdg_data_dir = fs::path(c_user_home) / ".local" / "share"; |
| 133 | } |
| 134 | |
| 135 | if (!xdg_data_dir.empty()) |
| 136 | { |
| 137 | auto metadata_path = xdg_data_dir / "wayfire" / "metadata"; |
| 138 | if (fs::exists(metadata_path)) |
| 139 | { |
| 140 | xmldirs.push_back(metadata_path.string()); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | xmldirs.push_back(PLUGIN_XML_DIR); |
| 145 | return xmldirs; |
| 146 | } |
| 147 | } |