void PrefHandler::SaveAsText(const char *path, const char *mimetype, const char *signature) { // make sure the target path exists #if 0 BPath directoryPath(path); if (directoryPath.GetParent(&directoryPath) == B_OK) create_directory(directoryPath.Path(), 0755); #endif BFile file(path, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); char buffer[512]; type_code type; const char *key; for (int32 i = 0; #ifdef B_BEOS_VERSION_DANO fContainer.GetInfo(B_STRING_TYPE, i, &key, &type) == B_OK; #else fContainer.GetInfo(B_STRING_TYPE, i, (char**)&key, &type) == B_OK; #endif i++) { int len = snprintf(buffer, sizeof(buffer), "\"%s\" , \"%s\"\n", key, getString(key)); file.Write(buffer, len); } if (mimetype != NULL) { BNodeInfo info(&file); info.SetType(mimetype); info.SetPreferredApp(signature); } }
void IncludedFilesParser::_processCreateDirective(xmlNode *node) { xmlNode *child = node->children; while (child != NULL) { string name((const char *)(child->name)); if (name == "path") { string filePath((const char *)xmlNodeGetContent(child)); manifest.addElement(filePath); } else if (name == "directory_path") { string directoryPath((const char *)xmlNodeGetContent(child)); std::vector<std::string> filePaths; mw::getFilePaths(getWorkingPathString(), directoryPath, filePaths); for (std::vector<std::string>::iterator iter = filePaths.begin(); iter != filePaths.end(); iter++) { manifest.addElement(*iter); } } child = child->next; } }
/*! * Appends to \a fileList directory files. */ void PluginManager::AddFilesToList( QDir directory, QStringList& filesList ) { QString directoryPath( directory.absolutePath().append( QLatin1String( "/" ) ) ); QStringList filenamesList = directory.entryList( QDir::Files, QDir::Unsorted ); for( int i = 0; i < filenamesList.size(); ++i ) filesList << ( directoryPath + filenamesList[i] ); }
FilePath::FilePath(const String &directory, const String &filename) { FilePath directoryPath(directory); DVASSERT(!directoryPath.IsEmpty()); directoryPath.MakeDirectoryPathname(); pathType = directoryPath.pathType; absolutePathname = AddPath(directoryPath, filename); }
/*! * Creates a list with the files al files in the defined \a directory * and its subdirectories. */ void PluginManager::BuildFileList( QDir directory, QStringList& filesList ) { AddFilesToList( directory, filesList ); QString directoryPath( directory.absolutePath().append( QLatin1String( "/" ) ) ); QStringList subdirectoriesList = directory.entryList( QDir::Dirs, QDir::Unsorted ); for( int i = 0; i< subdirectoriesList.size(); ++i ) { QString subdirectoryName = subdirectoriesList[i]; if( ValidDirectoryName( subdirectoryName ) ) BuildFileList( QDir( directoryPath + subdirectoryName ), filesList ); } }
WebCache::WebCache(bool isPrivateBrowsing) : m_doomAllEntriesCallback(this, &WebCache::doomAllEntries) , m_onClearDoneCallback(this, &WebCache::onClearDone) , m_isClearInProgress(false) , m_openEntryCallback(this, &WebCache::openEntry) , m_onGetEntryDoneCallback(this, &WebCache::onGetEntryDone) , m_isGetEntryInProgress(false) , m_cacheBackend(0) { base::Thread* ioThread = WebUrlLoaderClient::ioThread(); scoped_refptr<base::MessageLoopProxy> cacheMessageLoopProxy = ioThread->message_loop_proxy(); static const int kMaximumCacheSizeBytes = 20 * 1024 * 1024; m_hostResolver = net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, 0, 0,ioThread->message_loop()); if (!isPrivateBrowsing) { m_hostPreresolver = CreateResolverIPObserver(m_hostResolver.get()); } m_proxyConfigService = new ProxyConfigServiceAndroid(); net::HttpCache::BackendFactory* backendFactory; if (isPrivateBrowsing) backendFactory = net::HttpCache::DefaultBackend::InMemory(kMaximumCacheSizeBytes / 2); else { string storage(storageDirectory()); if (storage.empty()) // Can't get a storage directory from the OS backendFactory = net::HttpCache::DefaultBackend::InMemory(kMaximumCacheSizeBytes / 2); else { FilePath directoryPath(storage.c_str()); backendFactory = new net::HttpCache::DefaultBackend(net::DISK_CACHE, directoryPath, kMaximumCacheSizeBytes, cacheMessageLoopProxy); } } m_cache = new net::HttpCache(m_hostResolver.get(), new CertVerifier(), 0, // dnsrr_resolver 0, // dns_cert_checker net::ProxyService::CreateWithoutProxyResolver(m_proxyConfigService, 0 /* net_log */), net::SSLConfigService::CreateSystemSSLConfigService(), net::HttpAuthHandlerFactory::CreateDefault(m_hostResolver.get()), 0, // network_delegate 0, // net_log backendFactory); }
// Whether or not the DirectoryResource is ready for use by a SipxProcess. bool DirectoryResource::isReadyToStart(UtlString& missingResource) { OsPath directoryPath(*this); Os::Logger::instance().log(FAC_SUPERVISOR, PRI_DEBUG, "DirectoryResource::isReadyToStart checking for existence of %s", data()); bool bReady; if (mFilePattern.isNull()) { bReady = true; } else { bReady = OsFileSystem::exists(directoryPath); } if ( !bReady ) { missingResource = ""; appendDescription(missingResource); } return bReady; }