Debian Codegraph @

tests/manual/qstorageinfo/main.cpp

raw
1 // Copyright (C) 2016 Intel Corporation
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include <QtCore/QCoreApplication>
5
6 #include <stdio.h>
7
8 #include "printvolumes.cpp"
9
10 int main(int argc, char *argv[])
11 {
12 QCoreApplication a(argc, argv);
13
14 QList<QStorageInfo> volumes;
15 QStringList args = a.arguments();
16 args.takeFirst(); // skip application name
17
18 for (const QString &path : std::as_const(args)) {
19 QStorageInfo info(path);
20 if (!info.isValid()) {
21 // no error string...
22 fprintf(stderr, "Could not get info on %s\n", qPrintable(path));
23 return 1;
24 }
25 volumes << info;
26 }
27
28 if (volumes.isEmpty())
29 volumes = QStorageInfo::mountedVolumes();
30
31 printVolumes(volumes, printf);
32
33 return 0;
34 }