MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / getTempFileName

Method getTempFileName

3rdparty/qtcsv-qt5/sources/writer.cpp:179–196  ·  view source on GitHub ↗

Create unique name for the temporary file @output: - QString - string with the absolute path to the temporary file that is not exist yet. If function failed to create unique path, it will return empty string.

Source from the content-addressed store, hash-verified

177// exist yet. If function failed to create unique path, it will return empty
178// string.
179QString WriterPrivate::getTempFileName()
180{
181 QString nameTemplate = QDir::tempPath() + "/qtcsv_" +
182 QString::number(QCoreApplication::applicationPid()) + "_%1.csv";
183
184 for (int counter = 0; counter < std::numeric_limits<int>::max(); ++counter)
185 {
186#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
187 QString name = nameTemplate.arg(
188 QString::number(QRandomGenerator::global()->generate()));
189#else
190 QString name = nameTemplate.arg(QString::number(qrand()));
191#endif
192 if (false == QFile::exists(name)) { return name; }
193 }
194
195 return QString();
196}
197
198// Write data to csv-file
199// @input:

Callers

nothing calls this directly

Calls 2

generateMethod · 0.80
QStringClass · 0.70

Tested by

no test coverage detected