Is there a possibility to create such links in Qt?
Yes, it is, but only on Unix.
Unfortunately, this is not supported by QFile on Windows, not even by QDir. In my opinion, this would be a useful feature to submit a report for on the Qt Bug tracker.
The workaround would be to write something like this:
#ifdef Q_OS_UNIX
QFile::link(sourceDir.absolutePath(), destDir.absolutePath());
#elif Q_OS_WIN
QProcess process;
process.start("mklink /D");
// Wait for it to start
if(!process.waitForStarted())
return 0;
bool retval = false;
QByteArray buffer;
while ((retval = process.waitForFinished()));
buffer.append(process.readAll());
if (!retval) {
qDebug() << "Process error:" << process.errorString();
qDebug() << "Output:" << buffer;
return 1;
}
#endif
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…