本文整理汇总了C++中FileName::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::isEmpty方法的具体用法?C++ FileName::isEmpty怎么用?C++ FileName::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildHelper
bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
QString *log, QString *errorMessage)
{
const QChar newline = QLatin1Char('\n');
// Setup process
QProcess proc;
proc.setEnvironment(arguments.environment.toStringList());
proc.setWorkingDirectory(arguments.directory);
proc.setProcessChannelMode(QProcess::MergedChannels);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Building helper \"%1\" in %2\n").arg(arguments.helperName,
arguments.directory));
log->append(newline);
const FileName makeFullPath = arguments.environment.searchInPath(arguments.makeCommand);
if (QFileInfo::exists(arguments.directory + QLatin1String("/Makefile"))) {
if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
"%1 not found in PATH\n").arg(arguments.makeCommand);
return false;
}
const QString cleanTarget = QLatin1String("distclean");
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2...\n")
.arg(makeFullPath.toUserOutput(), cleanTarget));
if (!runBuildProcess(proc, makeFullPath, QStringList(cleanTarget), 30, true, log, errorMessage))
return false;
}
QStringList qmakeArgs;
if (!arguments.targetMode.isEmpty())
qmakeArgs << arguments.targetMode;
if (!arguments.mkspec.isEmpty())
qmakeArgs << QLatin1String("-spec") << arguments.mkspec.toUserOutput();
qmakeArgs << arguments.proFilename;
qmakeArgs << arguments.qmakeArguments;
log->append(newline);
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n").arg(arguments.qmakeCommand.toUserOutput(),
qmakeArgs.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, arguments.qmakeCommand, qmakeArgs, 30, false, log, errorMessage))
return false;
log->append(newline);
if (makeFullPath.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"%1 not found in PATH\n").arg(arguments.makeCommand);
return false;
}
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n")
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage))
return false;
return true;
}
示例2: filePathValue
static FileName filePathValue(const FileName &value, const QStringList &candidateFileNames)
{
if (!value.isEmpty())
return value;
const QList<FileName> additionalSearchPaths = sshSettings->searchPathRetriever();
for (const QString &candidate : candidateFileNames) {
const FileName filePath = Environment::systemEnvironment()
.searchInPath(candidate, additionalSearchPaths);
if (!filePath.isEmpty())
return filePath;
}
return FileName();
}
示例3: makeCommand
QString AndroidToolChain::makeCommand(const Environment &env) const
{
QStringList extraDirectories = AndroidConfigurations::currentConfig().makeExtraSearchDirectories();
if (HostOsInfo::isWindowsHost()) {
FileName tmp = env.searchInPath(QLatin1String("ma-make.exe"), extraDirectories);
if (!tmp.isEmpty())
return QString();
tmp = env.searchInPath(QLatin1String("mingw32-make"), extraDirectories);
return tmp.isEmpty() ? QLatin1String("mingw32-make") : tmp.toString();
}
QString make = QLatin1String("make");
FileName tmp = env.searchInPath(make, extraDirectories);
return tmp.isEmpty() ? make : tmp.toString();
}
示例4: handleCompilerCommandChange
void GoToolChainConfigWidget::handleCompilerCommandChange()
{
bool haveCompiler = false;
Abi currentAbi = m_abiWidget->currentAbi();
bool customAbi = m_abiWidget->isCustomAbi();
FileName path = m_compilerCommand->fileName();
QList<Abi> abiList;
if (!path.isEmpty()) {
QFileInfo fi(path.toFileInfo());
haveCompiler = fi.isExecutable() && fi.isFile();
}
if (haveCompiler) {
Environment env = Environment::systemEnvironment();
GccToolChain::addCommandPathToEnvironment(path, env);
abiList = GoToolChain::guessGoAbi(path, env.toStringList());
}
m_abiWidget->setEnabled(haveCompiler);
// Find a good ABI for the new compiler:
Abi newAbi;
if (customAbi)
newAbi = currentAbi;
else if (abiList.contains(currentAbi))
newAbi = currentAbi;
m_abiWidget->setAbis(abiList, newAbi);
emit dirty();
}
示例5: allArguments
///
/// Returns all arguments
/// That is: possbile subpath
/// spec
/// config arguemnts
/// moreArguments
/// user arguments
QString QMakeStep::allArguments(bool shorted)
{
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
QStringList arguments;
if (bc->subNodeBuild())
arguments << bc->subNodeBuild()->path().toUserOutput();
else if (shorted)
arguments << project()->projectFilePath().fileName();
else
arguments << project()->projectFilePath().toUserOutput();
arguments << QLatin1String("-r");
bool userProvidedMkspec = false;
for (QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
if (ait.value() == QLatin1String("-spec")) {
if (ait.next()) {
userProvidedMkspec = true;
break;
}
}
}
FileName specArg = mkspec();
if (!userProvidedMkspec && !specArg.isEmpty())
arguments << QLatin1String("-spec") << specArg.toUserOutput();
// Find out what flags we pass on to qmake
arguments << bc->configCommandLineArguments();
arguments << deducedArguments().toArguments();
QString args = QtcProcess::joinArgs(arguments);
// User arguments
QtcProcess::addArgs(&args, m_userArgs);
return args;
}
示例6: defaultValue
QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
{
Q_UNUSED(k);
// find "Qt in PATH":
QList<BaseQtVersion *> versionList = QtVersionManager::unsortedVersions();
BaseQtVersion *result = findOrDefault(versionList, equal(&BaseQtVersion::autodetectionSource,
QString::fromLatin1("PATH")));
if (result)
return result->uniqueId();
// Legacy: Check for system qmake path: Remove in 3.5 (or later):
// This check is expensive as it will potentially run binaries (qmake --version)!
const FileName qmakePath
= BuildableHelperLibrary::findSystemQt(Utils::Environment::systemEnvironment());
if (!qmakePath.isEmpty()) {
result = findOrDefault(versionList, equal(&BaseQtVersion::qmakeCommand, qmakePath));
if (result)
return result->uniqueId();
}
// Use *any* desktop Qt:
result = findOrDefault(versionList, equal(&BaseQtVersion::type,
QString::fromLatin1(QtSupport::Constants::DESKTOPQT)));
return result ? result->uniqueId() : -1;
}
示例7: findQtInstallPath
// Find Qt installation by running qmake
static QString findQtInstallPath(const FileName &qmakePath)
{
if (qmakePath.isEmpty())
return QString();
QProcess proc;
QStringList args;
args.append(QLatin1String("-query"));
args.append(QLatin1String("QT_INSTALL_HEADERS"));
proc.start(qmakePath.toString(), args);
if (!proc.waitForStarted()) {
qWarning("%s: Cannot start '%s': %s", Q_FUNC_INFO, qPrintable(qmakePath.toString()),
qPrintable(proc.errorString()));
return QString();
}
proc.closeWriteChannel();
if (!proc.waitForFinished()) {
SynchronousProcess::stopProcess(proc);
qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(qmakePath.toString()));
return QString();
}
if (proc.exitStatus() != QProcess::NormalExit) {
qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(qmakePath.toString()));
return QString();
}
const QByteArray ba = proc.readAllStandardOutput().trimmed();
QDir dir(QString::fromLocal8Bit(ba));
if (dir.exists() && dir.cdUp())
return dir.absolutePath();
return QString();
}
示例8: openJDKBinPath
FileName AndroidConfigurations::openJDKBinPath() const
{
FileName path = m_config.openJDKLocation;
if (!path.isEmpty())
return path.appendPath(QLatin1String("bin"));
return path;
}
示例9: setup
void QmakeKitInformation::setup(Kit *k)
{
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version)
return;
if (version->type() == "Boot2Qt.QtVersionType") // HACK: Ignore boot2Qt kits!
return;
FileName spec = QmakeKitInformation::mkspec(k);
if (spec.isEmpty())
spec = version->mkspec();
ToolChain *tc = ToolChainKitInformation::toolChain(k, ToolChain::Language::Cxx);
if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) {
ToolChain *possibleTc = nullptr;
foreach (ToolChain *current, ToolChainManager::toolChains()) {
if (current->language() == ToolChain::Language::Cxx
&& version->qtAbis().contains(current->targetAbi())) {
possibleTc = current;
if (current->suggestedMkspecList().contains(spec))
break;
}
}
if (possibleTc)
ToolChainKitInformation::setToolChain(k, possibleTc);
}
示例10: defaultDisplayName
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const FileName &qmakePath,
bool fromPath)
{
QString location;
if (qmakePath.isEmpty()) {
location = QCoreApplication::translate("QtVersion", "<unknown>");
} else {
// Deduce a description from '/foo/qt-folder/[qtbase]/bin/qmake' -> '/foo/qt-folder'.
// '/usr' indicates System Qt 4.X on Linux.
QDir dir = qmakePath.toFileInfo().absoluteDir();
do {
const QString dirName = dir.dirName();
if (dirName == QLatin1String("usr")) { // System-installed Qt.
location = QCoreApplication::translate("QtVersion", "System");
break;
}
location = dirName;
// Also skip default checkouts named 'qt'. Parent dir might have descriptive name.
if (dirName.compare(QLatin1String("bin"), Qt::CaseInsensitive)
&& dirName.compare(QLatin1String("qtbase"), Qt::CaseInsensitive)
&& dirName.compare(QLatin1String("qt"), Qt::CaseInsensitive)) {
break;
}
} while (dir.cdUp());
}
return fromPath ?
QCoreApplication::translate("QtVersion", "Qt %1 in PATH (%2)").arg(versionString, location) :
QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location);
}
示例11: updateExternalFileWarning
void ProjectTree::updateExternalFileWarning()
{
Core::IDocument *document = qobject_cast<Core::IDocument *>(sender());
if (!document || document->filePath().isEmpty())
return;
Core::InfoBar *infoBar = document->infoBar();
Core::Id externalFileId(EXTERNAL_FILE_WARNING);
if (!document->isModified()) {
infoBar->removeInfo(externalFileId);
return;
}
if (!infoBar->canInfoBeAdded(externalFileId))
return;
const FileName fileName = document->filePath();
const QList<Project *> projects = SessionManager::projects();
if (projects.isEmpty())
return;
foreach (Project *project, projects) {
FileName projectDir = project->projectDirectory();
if (projectDir.isEmpty())
continue;
if (fileName.isChildOf(projectDir))
return;
// External file. Test if it under the same VCS
QString topLevel;
if (Core::VcsManager::findVersionControlForDirectory(projectDir.toString(), &topLevel)
&& fileName.isChildOf(FileName::fromString(topLevel))) {
return;
}
}
示例12: versionRegExp
QList<AndroidToolChainFactory::AndroidToolChainInformation> AndroidToolChainFactory::toolchainPathsForNdk(const FileName &ndkPath)
{
QList<AndroidToolChainInformation> result;
if (ndkPath.isEmpty())
return result;
QRegExp versionRegExp(NDKGccVersionRegExp);
FileName path = ndkPath;
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
QStringList() << QLatin1String("*"), QDir::Dirs);
while (it.hasNext()) {
const QString &fileName = FileName::fromString(it.next()).fileName();
int idx = versionRegExp.indexIn(fileName);
if (idx == -1)
continue;
for (const ToolChain::Language lang : { ToolChain::Language::Cxx, ToolChain::Language::C }) {
AndroidToolChainInformation ati;
ati.language = lang;
ati.version = fileName.mid(idx + 1);
QString platform = fileName.left(idx);
ati.abi = AndroidConfig::abiForToolChainPrefix(platform);
if (ati.abi.architecture() == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
continue;
ati.compilerCommand = AndroidConfigurations::currentConfig().gccPath(ati.abi, lang, ati.version);
result.append(ati);
}
}
return result;
}
示例13: askpassFilePath
FileName SshSettings::askpassFilePath()
{
FileName candidate;
candidate = sshSettings->askpassFilePath;
if (candidate.isEmpty())
candidate = FileName::fromString(Environment::systemEnvironment().value("SSH_ASKPASS"));
return filePathValue(candidate, QStringList{"qtc-askpass", "ssh-askpass"});
}
示例14: MemoryMapTestFixture
MemoryMapTestFixture()
{
FileName testDir = getTestDataDirectory();
if (!testDir.isEmpty()) {
fileName = testDir / "maxdnn-memory-map-test-file";
}
length = 16385;
}
示例15: mkspecsPath
FileName BaseQtVersion::mkspecsPath() const
{
FileName result = FileName::fromUserInput(qmakeProperty("QT_HOST_DATA"));
if (result.isEmpty())
result = FileName::fromUserInput(qmakeProperty("QMAKE_MKSPECS"));
else
result.appendPath(QLatin1String("mkspecs"));
return result;
}