| 166 | } |
| 167 | |
| 168 | Future<std::vector<std::string>> BackupContainerLocalDirectory::listURLs(const std::string& url) { |
| 169 | std::string path; |
| 170 | if (url.find("file://") != 0) { |
| 171 | TraceEvent(SevWarn, "BackupContainerLocalDirectory") |
| 172 | .detail("Description", "Invalid URL for BackupContainerLocalDirectory") |
| 173 | .detail("URL", url); |
| 174 | } |
| 175 | |
| 176 | path = url.substr(7); |
| 177 | // Remove trailing slashes on path |
| 178 | path.erase(path.find_last_not_of("\\/") + 1); |
| 179 | |
| 180 | if (!g_network->isSimulated() && path != abspath(path)) { |
| 181 | TraceEvent(SevWarn, "BackupContainerLocalDirectory") |
| 182 | .detail("Description", "Backup path must be absolute (e.g. file:///some/path)") |
| 183 | .detail("URL", url) |
| 184 | .detail("Path", path); |
| 185 | throw io_error(); |
| 186 | } |
| 187 | std::vector<std::string> dirs = platform::listDirectories(path); |
| 188 | std::vector<std::string> results; |
| 189 | |
| 190 | for (const auto& r : dirs) { |
| 191 | if (r == "." || r == "..") |
| 192 | continue; |
| 193 | results.push_back(std::string("file://") + joinPath(path, r)); |
| 194 | } |
| 195 | |
| 196 | return results; |
| 197 | } |
| 198 | |
| 199 | Future<Void> BackupContainerLocalDirectory::create() { |
| 200 | if (usesEncryption()) { |
nothing calls this directly
no test coverage detected