comparison base/ResourceFinder.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 66c3f4e060e9
children 9a422d610058
comparison
equal deleted inserted replaced
842:23d3a6eca5c3 843:e802e550a1f2
153 SVDEBUG << "ResourceFinder::getResourcePath: Looking up file \"" << fileName << "\" for category \"" << resourceCat << "\" in prefix \"" << prefix << "\"" << endl; 153 SVDEBUG << "ResourceFinder::getResourcePath: Looking up file \"" << fileName << "\" for category \"" << resourceCat << "\" in prefix \"" << prefix << "\"" << endl;
154 154
155 QString path = 155 QString path =
156 QString("%1%2/%3").arg(prefix).arg(resourceCat).arg(fileName); 156 QString("%1%2/%3").arg(prefix).arg(resourceCat).arg(fileName);
157 if (QFileInfo(path).exists() && QFileInfo(path).isReadable()) { 157 if (QFileInfo(path).exists() && QFileInfo(path).isReadable()) {
158 std::cerr << "Found it!" << std::endl; 158 cerr << "Found it!" << endl;
159 return path; 159 return path;
160 } 160 }
161 } 161 }
162 162
163 return ""; 163 return "";
207 if (resourceCat != "") resourceCat = "/" + resourceCat; 207 if (resourceCat != "") resourceCat = "/" + resourceCat;
208 208
209 QDir userDir(user); 209 QDir userDir(user);
210 if (!userDir.exists()) { 210 if (!userDir.exists()) {
211 if (!userDir.mkpath(user)) { 211 if (!userDir.mkpath(user)) {
212 std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << user << "\"" << std::endl; 212 cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << user << "\"" << endl;
213 return ""; 213 return "";
214 } 214 }
215 } 215 }
216 216
217 if (resourceCat != "") { 217 if (resourceCat != "") {
218 QString save = QString("%1%2").arg(user).arg(resourceCat); 218 QString save = QString("%1%2").arg(user).arg(resourceCat);
219 QDir saveDir(save); 219 QDir saveDir(save);
220 if (!saveDir.exists()) { 220 if (!saveDir.exists()) {
221 if (!userDir.mkpath(save)) { 221 if (!userDir.mkpath(save)) {
222 std::cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << save << "\"" << std::endl; 222 cerr << "ResourceFinder::getResourceSaveDir: ERROR: Failed to create user resource path \"" << save << "\"" << endl;
223 return ""; 223 return "";
224 } 224 }
225 } 225 }
226 return save; 226 return save;
227 } else { 227 } else {
278 // Install one to the user location. 278 // Install one to the user location.
279 SVDEBUG << "ResourceFinder::unbundleResource: File " << fileName << " is bundled, un-bundling it" << endl; 279 SVDEBUG << "ResourceFinder::unbundleResource: File " << fileName << " is bundled, un-bundling it" << endl;
280 QString target = getResourceSavePath(resourceCat, fileName); 280 QString target = getResourceSavePath(resourceCat, fileName);
281 QFile file(path); 281 QFile file(path);
282 if (!file.copy(target)) { 282 if (!file.copy(target)) {
283 std::cerr << "ResourceFinder::unbundleResource: ERROR: Failed to un-bundle resource file \"" << fileName << "\" to user location \"" << target << "\"" << std::endl; 283 cerr << "ResourceFinder::unbundleResource: ERROR: Failed to un-bundle resource file \"" << fileName << "\" to user location \"" << target << "\"" << endl;
284 return false; 284 return false;
285 } 285 }
286 286
287 QFile chmod(target); 287 QFile chmod(target);
288 chmod.setPermissions(QFile::ReadOwner | 288 chmod.setPermissions(QFile::ReadOwner |