Mercurial > hg > svcore
comparison data/fileio/CachedFile.cpp @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | f2fcb3ed51fa |
children |
comparison
equal
deleted
inserted
replaced
1324:d4a28d1479a8 | 1527:710e6250a401 |
---|---|
155 | 155 |
156 if (retrieve()) { | 156 if (retrieve()) { |
157 SVDEBUG << "CachedFile::check: Retrieval succeeded" << endl; | 157 SVDEBUG << "CachedFile::check: Retrieval succeeded" << endl; |
158 updateLastRetrieval(true); | 158 updateLastRetrieval(true); |
159 } else { | 159 } else { |
160 cerr << "CachedFile::check: Retrieval failed, will try again later (using existing file for now)" << endl; | 160 SVCERR << "CachedFile::check: Retrieval failed, will try again later (using existing file for now)" << endl; |
161 } | 161 } |
162 } | 162 } |
163 } else { | 163 } else { |
164 SVDEBUG << "CachedFile::check: No valid last retrieval" << endl; | 164 SVDEBUG << "CachedFile::check: No valid last retrieval" << endl; |
165 // there is no acceptable file | 165 // there is no acceptable file |
166 if (retrieve()) { | 166 if (retrieve()) { |
167 SVDEBUG << "CachedFile::check: Retrieval succeeded" << endl; | 167 SVDEBUG << "CachedFile::check: Retrieval succeeded" << endl; |
168 m_ok = true; | 168 m_ok = true; |
169 updateLastRetrieval(true); | 169 updateLastRetrieval(true); |
170 } else { | 170 } else { |
171 cerr << "CachedFile::check: Retrieval failed, remaining in invalid state" << endl; | 171 SVCERR << "CachedFile::check: Retrieval failed, remaining in invalid state" << endl; |
172 // again, we don't need to do anything here -- the last | 172 // again, we don't need to do anything here -- the last |
173 // retrieval timestamp is already invalid | 173 // retrieval timestamp is already invalid |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
210 } | 210 } |
211 | 211 |
212 QFile previous(m_localFilename); | 212 QFile previous(m_localFilename); |
213 if (previous.exists()) { | 213 if (previous.exists()) { |
214 if (!previous.remove()) { | 214 if (!previous.remove()) { |
215 cerr << "CachedFile::retrieve: ERROR: Failed to remove previous copy of cached file at \"" << m_localFilename << "\"" << endl; | 215 SVCERR << "CachedFile::retrieve: ERROR: Failed to remove previous copy of cached file at \"" << m_localFilename << "\"" << endl; |
216 return false; | 216 return false; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 //!!! This is not ideal, could leave us with nothing (old file | 220 //!!! This is not ideal, could leave us with nothing (old file |
221 //!!! removed, new file not able to be copied in because e.g. no | 221 //!!! removed, new file not able to be copied in because e.g. no |
222 //!!! disk space left) | 222 //!!! disk space left) |
223 | 223 |
224 if (!tempFile.copy(m_localFilename)) { | 224 if (!tempFile.copy(m_localFilename)) { |
225 cerr << "CachedFile::retrieve: ERROR: Failed to copy newly retrieved file from \"" << tempName << "\" to \"" << m_localFilename << "\"" << endl; | 225 SVCERR << "CachedFile::retrieve: ERROR: Failed to copy newly retrieved file from \"" << tempName << "\" to \"" << m_localFilename << "\"" << endl; |
226 return false; | 226 return false; |
227 } | 227 } |
228 | 228 |
229 SVDEBUG << "CachedFile::retrieve: Successfully copied newly retrieved file \"" << tempName << "\" to its home at \"" << m_localFilename << "\"" << endl; | 229 SVDEBUG << "CachedFile::retrieve: Successfully copied newly retrieved file \"" << tempName << "\" to its home at \"" << m_localFilename << "\"" << endl; |
230 | 230 |