2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-01-22 12:26:14 +01:00
|
|
|
**
|
2016-01-15 14:57:14 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-01-22 12:26:14 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-01-22 12:26:14 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:14 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-01-22 12:26:14 +01:00
|
|
|
**
|
2016-01-15 14:57:14 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static FileType fileType(const QString &fileName);
|
|
|
|
|
static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; }
|
|
|
|
|
static bool isRelativePath(const QString &fileName);
|
|
|
|
|
static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); }
|
2013-05-31 20:04:31 +02:00
|
|
|
static QStringRef pathName(const QString &fileName); // Requires normalized path
|
2010-01-22 12:26:14 +01:00
|
|
|
static QStringRef fileName(const QString &fileName); // Requires normalized path
|
|
|
|
|
static QString resolvePath(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);
|
|
|
|
|
#endif
|
2010-01-22 12:26:14 +01:00
|
|
|
};
|
|
|
|
|
|
2012-07-06 09:51:50 +02:00
|
|
|
} // namespace ProFileEvaluatorInternal
|
|
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|