void File::throwError(char *pFilename, DWORD pError) { /* If we know this type of error throw a special case */ switch (pError) { case ERROR_DISK_FULL: throw DiskFullException(pFilename); case ERROR_ACCESS_DENIED: throw AccessDeniedException(pFilename); default: throw ErrorException(pFilename, pError); } }
QString StorageManager::ResolvePath (QUrl url) const { if (url.path ().startsWith ("/")) url.setPath (url.path ().mid (1)); const auto& path = QUrl::fromLocalFile (QDir::homePath () + '/') .resolved (url).toLocalFile (); const QFileInfo fi { path }; if (!fi.absoluteFilePath ().startsWith (QDir::homePath ())) throw AccessDeniedException (); return path; }
void AccessDeniedException::rethrow () const { throw AccessDeniedException (error); }