Example #1
0
AbstractFSProvider::status_t ZIPProvider::dir(const FileName & url, std::list<
		FileName> & result, uint8_t flags) {
	std::lock_guard<std::mutex> lock(handlesMutex);
	std::string archiveFileName;
	FileName localPath;
	decomposeURL(url, archiveFileName, localPath);
	ZIPHandle * handle = getZIPHandle(archiveFileName);
	if (handle == nullptr) {
		return FAILURE;
	}

	// Make sure all data has been written.
	if (handle->isChanged()) {
		delete handle;
		openHandles.erase(archiveFileName);
		handle = getZIPHandle(archiveFileName);
	}

	if (handle == nullptr) {
		return OK;
	}

	return handle->dir(localPath.getDir(), result, flags);
}