summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@nokia.com>2012-05-30 09:04:25 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2012-05-30 09:39:09 +0200
commitcedcc6eb4bc7c57c7cb5da06de121021faa82ba9 (patch)
tree4c593577530d526369f476b3dba20f19d1da5947
parentb7a40c7d68ceac52f7a4d1508f7eee54168b9e1f (diff)
normalize the pathes in windows create link functions
Change-Id: I83dd005fa3ee3732cb1884deb87c1bfebbbe3237 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@nokia.com> Reviewed-by: Oliver Wolff <oliver.wolff@nokia.com>
-rw-r--r--src/libs/installer/link.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libs/installer/link.cpp b/src/libs/installer/link.cpp
index b42e87b47..daf9daa61 100644
--- a/src/libs/installer/link.cpp
+++ b/src/libs/installer/link.cpp
@@ -77,7 +77,8 @@ public:
FileHandleWrapper(const QString &path)
: m_dirHandle(INVALID_HANDLE_VALUE)
{
- m_dirHandle = CreateFile(path.utf16(), GENERIC_READ | GENERIC_WRITE, 0, 0,
+ QString normalizedPath = QString(path).replace(QLatin1Char('/'), QLatin1Char('\\'));
+ m_dirHandle = CreateFile(normalizedPath.utf16(), GENERIC_READ | GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0);
if (m_dirHandle == INVALID_HANDLE_VALUE) {
qWarning() << QString::fromLatin1("Could not open: '%1'; error: %2\n").arg(path).arg(GetLastError());
@@ -116,8 +117,10 @@ Link createJunction(const QString &linkPath, const QString &targetPath)
}
TCHAR szDestDir[1024] = L"\\??\\"; //you need this to create valid unicode junctions
+
+ QString normalizedTargetPath = QString(targetPath).replace(QLatin1Char('/'), QLatin1Char('\\'));
//now we add the real absolute path
- StringCchCat(szDestDir, 1024, targetPath.utf16());
+ StringCchCat(szDestDir, 1024, normalizedTargetPath.utf16());
// Allocates a block of memory for an array of num elements(1) and initializes all its bits to zero.
_REPARSE_DATA_BUFFER* reparseStructData = (_REPARSE_DATA_BUFFER*)calloc(1,