Mercurial > hg > svcore
comparison base/TempDirectory.cpp @ 843:e802e550a1f2
Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 13:35:08 +0000 |
parents | b867c07478be |
children | f5cd33909744 |
comparison
equal
deleted
inserted
replaced
842:23d3a6eca5c3 | 843:e802e550a1f2 |
---|---|
204 | 204 |
205 if (fi.isDir()) { | 205 if (fi.isDir()) { |
206 cleanupDirectory(fi.absoluteFilePath()); | 206 cleanupDirectory(fi.absoluteFilePath()); |
207 } else { | 207 } else { |
208 if (!QFile(fi.absoluteFilePath()).remove()) { | 208 if (!QFile(fi.absoluteFilePath()).remove()) { |
209 std::cerr << "WARNING: TempDirectory::cleanup: " | 209 cerr << "WARNING: TempDirectory::cleanup: " |
210 << "Failed to unlink file \"" | 210 << "Failed to unlink file \"" |
211 << fi.absoluteFilePath() << "\"" | 211 << fi.absoluteFilePath() << "\"" |
212 << std::endl; | 212 << endl; |
213 } | 213 } |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 QString dirname = dir.dirName(); | 217 QString dirname = dir.dirName(); |
218 if (dirname != "") { | 218 if (dirname != "") { |
219 if (!dir.cdUp()) { | 219 if (!dir.cdUp()) { |
220 std::cerr << "WARNING: TempDirectory::cleanup: " | 220 cerr << "WARNING: TempDirectory::cleanup: " |
221 << "Failed to cd to parent directory of " | 221 << "Failed to cd to parent directory of " |
222 << tmpdir << std::endl; | 222 << tmpdir << endl; |
223 return; | 223 return; |
224 } | 224 } |
225 if (!dir.rmdir(dirname)) { | 225 if (!dir.rmdir(dirname)) { |
226 std::cerr << "WARNING: TempDirectory::cleanup: " | 226 cerr << "WARNING: TempDirectory::cleanup: " |
227 << "Failed to remove directory " | 227 << "Failed to remove directory " |
228 << dirname << std::endl; | 228 << dirname << endl; |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 if (isRoot) { | 232 if (isRoot) { |
233 m_tmpdir = ""; | 233 m_tmpdir = ""; |
245 QString dirpath = dir.filePath(dir[i]); | 245 QString dirpath = dir.filePath(dir[i]); |
246 | 246 |
247 QDir subdir(dirpath, "*.pid", QDir::Name, QDir::Files); | 247 QDir subdir(dirpath, "*.pid", QDir::Name, QDir::Files); |
248 | 248 |
249 if (subdir.count() == 0) { | 249 if (subdir.count() == 0) { |
250 std::cerr << "INFO: Found temporary directory with no .pid file in it!\n(directory=\"" | 250 cerr << "INFO: Found temporary directory with no .pid file in it!\n(directory=\"" |
251 << dirpath << "\"). Removing it..." << std::endl; | 251 << dirpath << "\"). Removing it..." << endl; |
252 cleanupDirectory(dirpath); | 252 cleanupDirectory(dirpath); |
253 std::cerr << "...done." << std::endl; | 253 cerr << "...done." << endl; |
254 continue; | 254 continue; |
255 } | 255 } |
256 | 256 |
257 for (unsigned int j = 0; j < subdir.count(); ++j) { | 257 for (unsigned int j = 0; j < subdir.count(); ++j) { |
258 | 258 |
259 bool ok = false; | 259 bool ok = false; |
260 int pid = QFileInfo(subdir[j]).baseName().toInt(&ok); | 260 int pid = QFileInfo(subdir[j]).baseName().toInt(&ok); |
261 if (!ok) continue; | 261 if (!ok) continue; |
262 | 262 |
263 if (GetProcessStatus(pid) == ProcessNotRunning) { | 263 if (GetProcessStatus(pid) == ProcessNotRunning) { |
264 std::cerr << "INFO: Found abandoned temporary directory from " | 264 cerr << "INFO: Found abandoned temporary directory from " |
265 << "a previous, defunct process\n(pid=" << pid | 265 << "a previous, defunct process\n(pid=" << pid |
266 << ", directory=\"" | 266 << ", directory=\"" |
267 << dirpath.toStdString() | 267 << dirpath.toStdString() |
268 << "\"). Removing it..." << std::endl; | 268 << "\"). Removing it..." << endl; |
269 cleanupDirectory(dirpath); | 269 cleanupDirectory(dirpath); |
270 std::cerr << "...done." << std::endl; | 270 cerr << "...done." << endl; |
271 break; | 271 break; |
272 } | 272 } |
273 } | 273 } |
274 } | 274 } |
275 } | 275 } |