Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
utils.cpp File Reference

(bf2f4678b0c1a17ad8d18809335cfb69d2c6527a)

#include "utils.h"
#include <QtCore/QString>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QTemporaryFile>
#include <QtCore/QScopedPointer>
#include <QtCore/QScopedArrayPointer>
#include <QtCore/QStandardPaths>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+ Include dependency graph for utils.cpp:

Go to the source code of this file.

Functions

bool isBuildDirectory (Platform platform, const QString &dirName)
 
bool createSymbolicLink (const QFileInfo &source, const QString &target, QString *errorMessage)
 
bool createDirectory (const QString &directory, QString *errorMessage, bool dryRun)
 
QStringList findSharedLibraries (const QDir &directory, Platform platform, DebugMatchMode debugMatchMode, const QString &prefix)
 
static char * encodeFileName (const QString &f)
 
static char * tempFilePattern ()
 
static QByteArray readOutRedirectFile (int fd)
 
bool runProcess (const QString &binary, const QStringList &args, const QString &workingDirectory, unsigned long *exitCode, QByteArray *stdOut, QByteArray *stdErr, QString *errorMessage)
 
QString findInPath (const QString &file)
 
QMap< QString, QStringqueryQtPaths (const QString &qtpathsBinary, QString *errorMessage)
 
bool updateFile (const QString &sourceFileName, const QStringList &nameFilters, const QString &targetDirectory, unsigned flags, JsonOutput *json, QString *errorMessage)
 
bool readPeExecutable (const QString &, QString *errorMessage, QStringList *, unsigned *, bool *, bool, unsigned short *)
 
QString findD3dCompiler (Platform, const QString &, unsigned)
 
QStringList findDxc (Platform, const QString &, unsigned)
 
bool patchQtCore (const QString &path, QString *errorMessage)
 

Variables

int optVerboseLevel = 1
 
const char * qmakeInfixKey = "QT_INFIX"
 

Function Documentation

◆ createDirectory()

bool createDirectory ( const QString & directory,
QString * errorMessage,
bool dryRun )

Definition at line 64 of file utils.cpp.

References arg, dir, directory, errorMessage(), QString::fromLatin1(), optVerboseLevel, and QDir::toNativeSeparators().

Referenced by deploy(), deployWebEngineCore(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createSymbolicLink()

bool createSymbolicLink ( const QFileInfo & source,
const QString & target,
QString * errorMessage )

Definition at line 45 of file utils.cpp.

References QDir::currentPath(), errorMessage(), QIODevice::errorString(), file, QString::fromLatin1(), QFile::link(), QStringLiteral, QDir::setCurrent(), and QDir::toNativeSeparators().

Referenced by updateFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encodeFileName()

static char * encodeFileName ( const QString & f)
inlinestatic

Definition at line 274 of file utils.cpp.

References QByteArray::constData(), encoded, QFile::encodeName(), and QByteArray::size().

Referenced by runProcess(), and tempFilePattern().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findD3dCompiler()

QString findD3dCompiler ( Platform platform,
const QString & qtBinDir,
unsigned wordSize )

Definition at line 937 of file utils.cpp.

Referenced by deploy().

+ Here is the caller graph for this function:

◆ findDxc()

QStringList findDxc ( Platform platform,
const QString & qtBinDir,
unsigned wordSize )

Definition at line 942 of file utils.cpp.

Referenced by deploy().

+ Here is the caller graph for this function:

◆ findInPath()

QString findInPath ( const QString & file)

Definition at line 405 of file utils.cpp.

References QDir::cleanPath(), file, QStandardPaths::findExecutable(), QString::fromWCharArray(), MAX_PATH, and QFile::size().

+ Here is the call graph for this function:

◆ findSharedLibraries()

QStringList findSharedLibraries ( const QDir & directory,
Platform platform,
DebugMatchMode debugMatchMode,
const QString & prefix )

Definition at line 88 of file utils.cpp.

References directory, errorMessage(), QDir::Files, QString::isEmpty(), MatchDebug, MatchDebugOrRelease, matches(), platform(), platformHasDebugSuffix(), readPeExecutable(), sharedLibrarySuffix(), QDir::toNativeSeparators(), WindowsBased, and WindowsDesktopMinGW.

Referenced by findFFmpegLibs(), findFileRecursion(), findOpenSslLibraries(), findQtPlugins(), DllDirectoryFileEntryFunction::operator()(), and parseArguments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isBuildDirectory()

bool isBuildDirectory ( Platform platform,
const QString & dirName )

Definition at line 37 of file utils.cpp.

References ClangMsvc, Msvc, and platform().

Referenced by findQmlDirectory(), and qmlDirectoryRecursion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ patchQtCore()

bool patchQtCore ( const QString & path,
QString * errorMessage )

Definition at line 950 of file utils.cpp.

References QFileDevice::close(), errorMessage(), QIODevice::errorString(), file, QFileInfo::fileName(), QString::fromLatin1(), QByteArray::indexOf(), QFile::open(), optVerboseLevel, QByteArray(), QIODevice::readAll(), QIODeviceBase::ReadOnly, QByteArray::replace(), QByteArray::size(), QDir::toNativeSeparators(), QIODevice::write(), and QIODeviceBase::WriteOnly.

Referenced by deploy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ queryQtPaths()

QMap< QString, QString > queryQtPaths ( const QString & qtpathsBinary,
QString * errorMessage )

Definition at line 423 of file utils.cpp.

References errorMessage(), QString::fromLocal8Bit(), QString::fromUtf8(), QString::indexOf(), QString::isEmpty(), line, QString::number(), output, pos, qmakeInfixKey, QStringLiteral, QIODeviceBase::ReadOnly, QString::right(), runProcess(), QString::size(), QString::startsWith(), QIODeviceBase::Text, QDir::toNativeSeparators(), and QString::trimmed().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readOutRedirectFile()

static QByteArray readOutRedirectFile ( int fd)
inlinestatic

Definition at line 291 of file utils.cpp.

References read().

Referenced by runProcess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPeExecutable()

bool readPeExecutable ( const QString & peExecutableFileName,
QString * errorMessage,
QStringList * dependentLibraries,
unsigned * wordSize,
bool * isDebug,
bool isMinGW,
unsigned short * machineArch )

Definition at line 930 of file utils.cpp.

References errorMessage(), and QStringLiteral.

Referenced by findDependentLibraries(), findDependentQtLibraries(), findPluginNames(), and findSharedLibraries().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runProcess()

bool runProcess ( const QString & binary,
const QStringList & args,
const QString & workingDirectory,
unsigned long * exitCode,
QByteArray * stdOut,
QByteArray * stdErr,
QString * errorMessage )

Definition at line 311 of file utils.cpp.

References args, encodeFileName(), errorMessage(), QString::fromLocal8Bit(), QStringLiteral, readOutRedirectFile(), QDir::setCurrent(), QList< T >::size(), and tempFilePattern().

Referenced by deployTranslations(), queryQtPaths(), and runQmlImportScanner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tempFilePattern()

static char * tempFilePattern ( )
inlinestatic

Definition at line 282 of file utils.cpp.

References encodeFileName(), QStringLiteral, and QDir::tempPath().

Referenced by createTemporaryItemCopy(), and runProcess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFile()

bool updateFile ( const QString & sourceFileName,
const QStringList & nameFilters,
const QString & targetDirectory,
unsigned flags,
JsonOutput * json,
QString * errorMessage )

Definition at line 479 of file utils.cpp.

References JsonOutput::addFile(), QFile::copy(), d, dir, QDir::Dirs, errorMessage(), QIODevice::errorString(), file, QDir::Files, ForceUpdateFile, QString::fromLatin1(), QDir::NoDotAndDotDot, optVerboseLevel, QFile::remove(), SkipUpdateFile, QDir::toNativeSeparators(), and updateFile().

Referenced by updateFile(), updateFile(), and updateFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ optVerboseLevel

◆ qmakeInfixKey

const char* qmakeInfixKey = "QT_INFIX"

Definition at line 421 of file utils.cpp.

Referenced by deploy(), PluginInformation::generateAvailablePlugins(), and queryQtPaths().