Strip prepending <hostname>: string from currentPath() for VxSim

VxWorks simulator (VxSim) maps SDK rootdir usable as normal directory.
Mapped directory name is either host: or <hostname>: and can be used
without prepending prefix containing colon. Strip prepending string and
colon to get valid native path to host SDK rootdir running VxSim.

Change-Id: I9d2829e32431c2d50fefe55c93780cd37165e565
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
Pasi Petäjäjärvi 2013-01-03 15:50:45 +02:00 committed by The Qt Project
parent 608cd1ad84
commit cd5a4279f3

View File

@ -685,8 +685,16 @@ QFileSystemEntry QFileSystemEngine::currentPath()
} }
#else #else
char currentName[PATH_MAX+1]; char currentName[PATH_MAX+1];
if (::getcwd(currentName, PATH_MAX)) if (::getcwd(currentName, PATH_MAX)) {
#if defined(Q_OS_VXWORKS) && defined(VXWORKS_VXSIM)
QByteArray dir(currentName);
if (dir.indexOf(':') < dir.indexOf('/'))
dir.remove(0, dir.indexOf(':')+1);
qstrncpy(currentName, dir.constData(), PATH_MAX);
#endif
result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath()); result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
}
# if defined(QT_DEBUG) # if defined(QT_DEBUG)
if (result.isEmpty()) if (result.isEmpty())
qWarning("QFileSystemEngine::currentPath: getcwd() failed"); qWarning("QFileSystemEngine::currentPath: getcwd() failed");