From cd5a4279f38ac6cca8ff8da4d75c2577d9b0bbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Thu, 3 Jan 2013 15:50:45 +0200 Subject: Strip prepending : string from currentPath() for VxSim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VxWorks simulator (VxSim) maps SDK rootdir usable as normal directory. Mapped directory name is either host: or : 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 --- src/corelib/io/qfilesystemengine_unix.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index fa0e07b045..03a682a234 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -685,8 +685,16 @@ QFileSystemEntry QFileSystemEngine::currentPath() } #else 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()); + } # if defined(QT_DEBUG) if (result.isEmpty()) qWarning("QFileSystemEngine::currentPath: getcwd() failed"); -- cgit v1.2.3