From e9987783a170cc478b17be1f544fe67f1ac745a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 11 Feb 2013 14:27:01 +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: I15f4bf4d9eb2cea87268bad9b1a95973962cb2c8 (cherry picked from qtbase/cd5a4279f38ac6cca8ff8da4d75c2577d9b0bbcd) Reviewed-by: Samuel Rødal --- src/corelib/io/qfilesystemengine_unix.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index b4e64e9..0c84a0f 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -675,8 +675,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("QFSFileEngine::currentPath: getcwd() failed"); -- cgit v0.12