| 1178 | } |
| 1179 | |
| 1180 | static bool LockDataDirectory(bool probeOnly) |
| 1181 | { |
| 1182 | // Make sure only a single Bitcoin process is using the data directory. |
| 1183 | fs::path datadir = GetDataDir(); |
| 1184 | if (!DirIsWritable(datadir)) { |
| 1185 | return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string())); |
| 1186 | } |
| 1187 | if (!LockDirectory(datadir, ".lock", probeOnly)) { |
| 1188 | return InitError(strprintf(_("Cannot obtain a lock on data directory %s. %s is probably already running."), datadir.string(), _(PACKAGE_NAME))); |
| 1189 | } |
| 1190 | return true; |
| 1191 | } |
| 1192 | |
| 1193 | bool AppInitSanityChecks() |
| 1194 | { |
no test coverage detected