2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2010-01-22 12:26:14 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-01-22 12:26:14 +01:00
|
|
|
|
2016-10-21 20:23:07 +02:00
|
|
|
#include "qmake_global.h"
|
|
|
|
|
|
2012-08-31 18:30:51 +02:00
|
|
|
#include <qstring.h>
|
2010-01-22 12:26:14 +01:00
|
|
|
|
2012-07-06 09:51:50 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
2011-10-25 15:55:14 +02:00
|
|
|
|
2012-09-03 21:30:28 +02:00
|
|
|
namespace QMakeInternal {
|
2010-01-22 12:26:14 +01:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
This class provides replacement functionality for QFileInfo, QFile & QDir,
|
|
|
|
|
as these are abysmally slow.
|
|
|
|
|
*/
|
2016-10-21 20:23:07 +02:00
|
|
|
class QMAKE_EXPORT IoUtils {
|
2010-01-22 12:26:14 +01:00
|
|
|
public:
|
|
|
|
|
enum FileType {
|
|
|
|
|
FileNotFound = 0,
|
|
|
|
|
FileIsRegular = 1,
|
|
|
|
|
FileIsDir = 2
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-30 16:39:21 +01:00
|
|
|
static FileType fileType(const QString &device, const QString &fileName);
|
|
|
|
|
static bool exists(const QString &device, const QString &fileName) { return fileType(device, fileName) != FileNotFound; }
|
|
|
|
|
static bool isRelativePath(const QString &device, const QString &fileName);
|
|
|
|
|
static bool isAbsolutePath(const QString &device, const QString &fileName) { return !isRelativePath(device, fileName); }
|
2020-09-11 11:32:43 +02:00
|
|
|
static QStringView pathName(const QString &fileName); // Requires normalized path
|
|
|
|
|
static QStringView fileName(const QString &fileName); // Requires normalized path
|
2022-11-30 16:39:21 +01:00
|
|
|
static QString resolvePath(const QString &device, const QString &baseDir, const QString &fileName);
|
2012-07-25 20:02:23 +02:00
|
|
|
static QString shellQuoteUnix(const QString &arg);
|
|
|
|
|
static QString shellQuoteWin(const QString &arg);
|
|
|
|
|
static QString shellQuote(const QString &arg)
|
|
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
|
{ return shellQuoteUnix(arg); }
|
|
|
|
|
#else
|
|
|
|
|
{ return shellQuoteWin(arg); }
|
2011-04-20 22:26:01 +02:00
|
|
|
#endif
|
2017-02-24 16:22:53 +01:00
|
|
|
#if defined(PROEVALUATOR_FULL)
|
|
|
|
|
static bool touchFile(const QString &targetFileName, const QString &referenceFileName, QString *errorString);
|
2017-03-01 12:41:48 +01:00
|
|
|
# if defined(QT_BUILD_QMAKE) && defined(Q_OS_UNIX)
|
|
|
|
|
static bool readLinkTarget(const QString &symlinkPath, QString *target);
|
|
|
|
|
# endif
|
2017-02-24 16:22:53 +01:00
|
|
|
#endif
|
2010-01-22 12:26:14 +01:00
|
|
|
};
|
|
|
|
|
|
2012-07-06 09:51:50 +02:00
|
|
|
} // namespace ProFileEvaluatorInternal
|
|
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|