/*
-----BEGIN QCMOD-----
name: qcapluginpath
section: project
arg: plugins-path=[path],Path to install to (unix only).  Default: qtdir/plugins
-----END QCMOD-----
*/

class qc_qcapluginpath : public ConfObj
{
public:
	qc_qcapluginpath(Conf *c) : ConfObj(c) {}
	QString name() const { return "qcapluginpath"; }
	QString shortname() const { return "qcapluginpath"; }

	// no output
	QString checkString() const { return QString(); }

	bool exec()
	{
#ifndef Q_OS_WIN
		QString plugins_path = conf->getenv("QC_PLUGINS_PATH");

		// default to qtdir
		if(plugins_path.isEmpty())
			plugins_path = QLibraryInfo::location(QLibraryInfo::PluginsPath);

		// install into plugins path
		QString str;
		str += QString(
		"target.path=%1/crypto\n"
		"INSTALLS += target\n"
		).arg(plugins_path);
		conf->addExtra(str);
#endif

		return true;
	}
};
