Bootstrap: remove QTemporaryFile
Done by harmonizing the use on the QT_CONFIG(temporaryfile) macro and fixing one test that was missing. We can't remove the older macro because it is marked PBULIC) but we don't need to use it ourselves. Change-Id: I01ec3c774d9943adb903fffd17b7eb4dd1a4e63f Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
7942f7eedf
commit
b57a9a3cd9
@ -84,7 +84,7 @@
|
|||||||
#define QT_FEATURE_slog2 -1
|
#define QT_FEATURE_slog2 -1
|
||||||
#define QT_FEATURE_syslog -1
|
#define QT_FEATURE_syslog -1
|
||||||
#define QT_NO_SYSTEMLOCALE
|
#define QT_NO_SYSTEMLOCALE
|
||||||
#define QT_FEATURE_temporaryfile 1
|
#define QT_FEATURE_temporaryfile -1
|
||||||
#define QT_FEATURE_textdate 1
|
#define QT_FEATURE_textdate 1
|
||||||
#undef QT_FEATURE_thread
|
#undef QT_FEATURE_thread
|
||||||
#define QT_FEATURE_thread -1
|
#define QT_FEATURE_thread -1
|
||||||
|
@ -584,7 +584,7 @@ QFile::rename(const QString &newName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#if defined(Q_OS_LINUX) && QT_CONFIG(temporaryfile)
|
||||||
// rename() on Linux simply does nothing when renaming "foo" to "Foo" on a case-insensitive
|
// rename() on Linux simply does nothing when renaming "foo" to "Foo" on a case-insensitive
|
||||||
// FS, such as FAT32. Move the file away and rename in 2 steps to work around.
|
// FS, such as FAT32. Move the file away and rename in 2 steps to work around.
|
||||||
QTemporaryFileName tfn(d->fileName);
|
QTemporaryFileName tfn(d->fileName);
|
||||||
@ -789,7 +789,7 @@ QFile::copy(const QString &newName)
|
|||||||
d->setError(QFile::CopyError, tr("Cannot open %1 for input").arg(d->fileName));
|
d->setError(QFile::CopyError, tr("Cannot open %1 for input").arg(d->fileName));
|
||||||
} else {
|
} else {
|
||||||
const auto fileTemplate = "%1/qt_temp.XXXXXX"_L1;
|
const auto fileTemplate = "%1/qt_temp.XXXXXX"_L1;
|
||||||
#ifdef QT_NO_TEMPORARYFILE
|
#if !QT_CONFIG(temporaryfile)
|
||||||
QFile out(fileTemplate.arg(QFileInfo(newName).path()));
|
QFile out(fileTemplate.arg(QFileInfo(newName).path()));
|
||||||
if (!out.open(QIODevice::ReadWrite))
|
if (!out.open(QIODevice::ReadWrite))
|
||||||
error = true;
|
error = true;
|
||||||
@ -841,7 +841,7 @@ QFile::copy(const QString &newName)
|
|||||||
.arg(newName, out.errorString()));
|
.arg(newName, out.errorString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef QT_NO_TEMPORARYFILE
|
#if !QT_CONFIG(temporaryfile)
|
||||||
if (error)
|
if (error)
|
||||||
out.remove();
|
out.remove();
|
||||||
#else
|
#else
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "qsavefile.h"
|
#include "qsavefile.h"
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
#include "qplatformdefs.h"
|
#include "qplatformdefs.h"
|
||||||
#include "private/qsavefile_p.h"
|
#include "private/qsavefile_p.h"
|
||||||
@ -412,4 +412,4 @@ QT_END_NAMESPACE
|
|||||||
#include "moc_qsavefile.cpp"
|
#include "moc_qsavefile.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
#include <QtCore/qfiledevice.h>
|
#include <QtCore/qfiledevice.h>
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
@ -62,6 +62,6 @@ private:
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
#endif // QSAVEFILE_H
|
#endif // QSAVEFILE_H
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
#include "private/qfiledevice_p.h"
|
#include "private/qfiledevice_p.h"
|
||||||
|
|
||||||
@ -42,6 +42,6 @@ protected:
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
#endif // QSAVEFILE_P_H
|
#endif // QSAVEFILE_P_H
|
||||||
|
@ -129,12 +129,12 @@ bool QConfFile::isWritable() const
|
|||||||
{
|
{
|
||||||
QFileInfo fileInfo(name);
|
QFileInfo fileInfo(name);
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
if (fileInfo.exists()) {
|
if (fileInfo.exists()) {
|
||||||
#endif
|
#endif
|
||||||
QFile file(name);
|
QFile file(name);
|
||||||
return file.open(QFile::ReadWrite);
|
return file.open(QFile::ReadWrite);
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
} else {
|
} else {
|
||||||
// Create the directories to the file.
|
// Create the directories to the file.
|
||||||
QDir dir(fileInfo.absolutePath());
|
QDir dir(fileInfo.absolutePath());
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "qtemporarydir.h"
|
#include "qtemporarydir.h"
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
#include "qplatformdefs.h"
|
#include "qplatformdefs.h"
|
||||||
@ -324,4 +324,4 @@ bool QTemporaryDir::remove()
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
class QTemporaryDirPrivate;
|
class QTemporaryDirPrivate;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ inline void swap(QTemporaryDir &lhs, QTemporaryDir &rhs) noexcept
|
|||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ QFileSystemEntry::NativePath QTemporaryFileName::generateNext()
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
@ -969,7 +969,7 @@ bool QTemporaryFile::open(OpenMode flags)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
class QTemporaryFilePrivate;
|
class QTemporaryFilePrivate;
|
||||||
class QLockFilePrivate;
|
class QLockFilePrivate;
|
||||||
@ -94,7 +94,7 @@ private:
|
|||||||
Q_DISABLE_COPY(QTemporaryFile)
|
Q_DISABLE_COPY(QTemporaryFile)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ struct QTemporaryFileName
|
|||||||
QFileSystemEntry::NativePath generateNext();
|
QFileSystemEntry::NativePath generateNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef QT_NO_TEMPORARYFILE
|
#if QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
class QTemporaryFilePrivate : public QFilePrivate
|
class QTemporaryFilePrivate : public QFilePrivate
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ public:
|
|||||||
bool unnamedFile = false;
|
bool unnamedFile = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_NO_TEMPORARYFILE
|
#endif // QT_CONFIG(temporaryfile)
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ qt_internal_extend_target(Bootstrap
|
|||||||
../../corelib/io/qresource.cpp
|
../../corelib/io/qresource.cpp
|
||||||
../../corelib/io/qsavefile.cpp
|
../../corelib/io/qsavefile.cpp
|
||||||
../../corelib/io/qstandardpaths.cpp
|
../../corelib/io/qstandardpaths.cpp
|
||||||
../../corelib/io/qtemporaryfile.cpp
|
|
||||||
../../corelib/kernel/qcoreapplication.cpp
|
../../corelib/kernel/qcoreapplication.cpp
|
||||||
../../corelib/kernel/qiterable.cpp
|
../../corelib/kernel/qiterable.cpp
|
||||||
../../corelib/kernel/qmetacontainer.cpp
|
../../corelib/kernel/qmetacontainer.cpp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user