1 | #include <QtCore>
|
---|
2 |
|
---|
3 | #include <QDebug>
|
---|
4 |
|
---|
5 | #include <stdlib.h>
|
---|
6 | //#include <InnoTekLIBC/pathrewrite.h>
|
---|
7 |
|
---|
8 | #define STR(expr) #expr
|
---|
9 | #define DBG(expr) STR(expr) << "=" << (expr)
|
---|
10 |
|
---|
11 | ////////////////////////////////////////////////////////////////////////////////
|
---|
12 |
|
---|
13 | void enumDir(const QDir &dir)
|
---|
14 | {
|
---|
15 | qDebug() << "Listing of " << dir.path() << " => " << dir.canonicalPath() << ":";
|
---|
16 | QDirIterator it(dir);
|
---|
17 | while (it.hasNext())
|
---|
18 | {
|
---|
19 | it.next();
|
---|
20 | QFileInfo fi = it.fileInfo();
|
---|
21 | qDebug() << DBG(fi.filePath()) << DBG(fi.isSymLink());
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | int main(int argc, char *argv[])
|
---|
26 | {
|
---|
27 | char buf[260];
|
---|
28 |
|
---|
29 | qDebug() << DBG((_abspath(buf, "/@unixroot/etc/ssl/certs", sizeof(buf)), buf));
|
---|
30 | qDebug() << DBG((_fullpath(buf, "/@unixroot/etc/ssl/certs", sizeof(buf)), buf));
|
---|
31 | qDebug() << DBG(realpath("/@unixroot/etc/ssl/certs", buf));
|
---|
32 |
|
---|
33 | QDir dir ("/@unixroot/etc/ssl/certs");
|
---|
34 |
|
---|
35 | qDebug() << DBG(dir);
|
---|
36 | qDebug() << DBG(dir.absolutePath());
|
---|
37 | qDebug() << DBG(dir.absoluteFilePath(""));
|
---|
38 | qDebug() << DBG(dir.canonicalPath());
|
---|
39 |
|
---|
40 | dir.setNameFilters(QStringList("*"));
|
---|
41 | qDebug() << DBG(dir);
|
---|
42 | enumDir(dir);
|
---|
43 |
|
---|
44 | dir.setPath("/@unixroot/etc/ssl");
|
---|
45 | qDebug() << DBG(dir);
|
---|
46 | enumDir(dir);
|
---|
47 |
|
---|
48 | QFileInfo fi ("/@unixroot/etc/ssl/certs");
|
---|
49 | qDebug() << DBG(fi.fileName());
|
---|
50 | qDebug() << DBG(fi.filePath());
|
---|
51 | qDebug() << DBG(fi.absoluteFilePath());
|
---|
52 | qDebug() << DBG(fi.canonicalFilePath());
|
---|
53 | qDebug() << DBG(fi.isFile());
|
---|
54 | qDebug() << DBG(fi.isDir());
|
---|
55 | qDebug() << DBG(fi.isSymLink());
|
---|
56 | qDebug() << DBG(fi.symLinkTarget());
|
---|
57 |
|
---|
58 | dir.setPath("D:/Temp/notexistent");
|
---|
59 | qDebug() << DBG(dir);
|
---|
60 | enumDir(dir);
|
---|
61 | }
|
---|