| 1174 | } |
| 1175 | |
| 1176 | static bool LockDirectory(const fs::path& dir, bool probeOnly) |
| 1177 | { |
| 1178 | // Make sure only a single process is using the directory. |
| 1179 | switch (util::LockDirectory(dir, ".lock", probeOnly)) { |
| 1180 | case util::LockResult::ErrorWrite: |
| 1181 | return InitError(strprintf(_("Cannot write to directory '%s'; check permissions."), fs::PathToString(dir))); |
| 1182 | case util::LockResult::ErrorLock: |
| 1183 | return InitError(strprintf(_("Cannot obtain a lock on directory %s. %s is probably already running."), fs::PathToString(dir), CLIENT_NAME)); |
| 1184 | case util::LockResult::Success: return true; |
| 1185 | } // no default case, so the compiler can warn about missing cases |
| 1186 | assert(false); |
| 1187 | } |
| 1188 | static bool LockDirectories(bool probeOnly) |
| 1189 | { |
| 1190 | return LockDirectory(gArgs.GetDataDirNet(), probeOnly) && \ |
no test coverage detected