コード例 #1
0
void BtInstallThread::removeModule()
{
	qDebug() << "BtInstallThread::removeModule start";
	CSwordModuleInfo* m;
	m = CPointers::backend()->findModuleByName(m_module);
	if (!m) {
		m = instbackend::backend(instbackend::source(m_destination.toLatin1()))->findModuleByName(m_module);
	}
	if (m) { //module found?
		qDebug() << "BtInstallThread::removeModule, module" << m_module << "found";
		QString prefixPath = m->config(CSwordModuleInfo::AbsoluteDataPath) + "/";
		QString dataPath = m->config(CSwordModuleInfo::DataPath);
		if (dataPath.left(2) == "./") {
			dataPath = dataPath.mid(2);
		}

		if (prefixPath.contains(dataPath)) {
			prefixPath.remove( prefixPath.indexOf(dataPath), dataPath.length() );
		}
		else {
			prefixPath = QString::fromLatin1(CPointers::backend()->prefixPath);
		}

		sword::SWMgr mgr(prefixPath.toLatin1());
		BtInstallMgr iMgr;
		iMgr.removeModule(&mgr, m->name().toLatin1());
	} else {
		qDebug() << "BtInstallThread::removeModule, module" << m_module << "not found";
	}
}