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

Method getTempFileName

3rdparty/qtcsv/sources/writer.cpp:163–177  ·  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

161// exist yet. If function failed to create unique path, it will return empty
162// string.
163QString WriterPrivate::getTempFileName()
164{
165 const auto nameTemplate = QDir::tempPath() + "/qtcsv_" +
166 QString::number(QCoreApplication::applicationPid()) + "_%1.csv";
167
168 for (auto counter = 0; counter < std::numeric_limits<int>::max(); ++counter)
169 {
170 QString name = nameTemplate.arg(
171 QString::number(QRandomGenerator::global()->generate()));
172
173 if (!QFile::exists(name)) { return name; }
174 }
175
176 return QString();
177}
178
179// Write data to csv-file
180// @input:

Callers

nothing calls this directly

Calls 2

generateMethod · 0.80
QStringClass · 0.50

Tested by

no test coverage detected