MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / saveFileName_

Function saveFileName_

src/openms/source/SYSTEM/File.cpp:897–916  ·  view source on GitHub ↗

construct a filename. Add number if already exists.

Source from the content-addressed store, hash-verified

895
896 // construct a filename. Add number if already exists.
897 QString saveFileName_(const QUrl &url)
898 {
899 QString path = url.path();
900 QString basename = QFileInfo(path).fileName();
901
902 if (basename.isEmpty())
903 basename = "download";
904
905 if (QFile::exists(basename)) {
906 // already exists, don't overwrite
907 int i = 0;
908 basename += '.';
909 while (QFile::exists(basename + QString::number(i)))
910 ++i;
911
912 basename += QString::number(i);
913 }
914
915 return basename;
916 }
917
918// static
919void File::download(const std::string& url, const std::string& download_folder)

Callers 1

downloadMethod · 0.85

Calls 3

numberFunction · 0.85
pathMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected