summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@nokia.com>2012-05-31 12:18:24 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2012-05-31 19:28:59 +0200
commita240e7dbadc3f0cbcd4a483ddf7093562df8ca37 (patch)
treeac2cbafe68986c63f05d424a3e7b6e3e00ee9019
parentd09bc5e530abcba57fa6e791857c1bdcadf59148 (diff)
windows needs to know that the link will be a directory
- but at the moment the directory doesn't exist so the only thing is to get that information from the last char Change-Id: I96ecc086ca19047dc0a3ae57262e903ae8923535 Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
-rw-r--r--src/libs/installer/link.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libs/installer/link.cpp b/src/libs/installer/link.cpp
index ac70ff423..59a56a397 100644
--- a/src/libs/installer/link.cpp
+++ b/src/libs/installer/link.cpp
@@ -144,9 +144,8 @@ 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, normalizedTargetPath.utf16());
+ StringCchCat(szDestDir, 1024, targetPath.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,
@@ -229,7 +228,9 @@ Link::Link(const QString &path) : m_path(path)
Link Link::create(const QString &link, const QString &targetPath)
{
QStringList pathParts = QFileInfo(link).absoluteFilePath().split(QLatin1Char('/'));
+
pathParts.removeLast();
+
QString linkPath = pathParts.join(QLatin1String("/"));
bool linkPathExists = QFileInfo(linkPath).exists();
if (!linkPathExists)
@@ -241,11 +242,13 @@ Link Link::create(const QString &link, const QString &targetPath)
}
#ifdef Q_OS_WIN
- if (QFileInfo(targetPath).isDir())
+ QString normalizedTargetPath = QString(targetPath).replace(QLatin1Char('/'), QLatin1Char('\\'));
+ if (normalizedTargetPath.endsWith(QLatin1Char('\\')))
return createJunction(link, targetPath);
qWarning() << QString::fromLatin1("At the moment the %1 can not create anything else as "\
- "junctions for directories under windows").arg(QLatin1String(Q_FUNC_INFO));
+ "junctions for directories under windows (targetPath needs a seperator at the end)").arg(
+ QLatin1String(Q_FUNC_INFO));
return Link(link);
#else
return createLnSymlink(link, targetPath);