From ba60b8a90e57f07625c1def4dab7cdbba4aaae48 Mon Sep 17 00:00:00 2001 From: Dave Brotherstone Date: Fri, 7 Apr 2017 22:19:51 +0200 Subject: [PATCH 1/2] Ignore the visual studio 2015 stuff --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 085a5b1..2dcb07e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ *.vcproj.user *.vcproj.*.user *.vcxproj.user +*.opendb +*.db BuildLog.htm doc/Thumbs.db Debug/ From a4a2e3f578e777ad412462e6068ee7607e31ca7d Mon Sep 17 00:00:00 2001 From: Dave Brotherstone Date: Fri, 7 Apr 2017 23:07:28 +0200 Subject: [PATCH 2/2] Fix copystep when run via gpup The CopyStep serialisation was using the wrong destination path for recursive directories, and using the wrong flag for validate. --- libinstall/src/CopyStep.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libinstall/src/CopyStep.cpp b/libinstall/src/CopyStep.cpp index c31ea0f..742f8e5 100644 --- a/libinstall/src/CopyStep.cpp +++ b/libinstall/src/CopyStep.cpp @@ -314,6 +314,12 @@ StepStatus CopyStep::copyDirectory(tstring& fromPath, tstring& toPath, } + // Mainly for gpup, but also if copying to a filename, the path must exist + tstring destPath = dest.substr(0, dest.find_last_of(_T("\\"))); + if (!::PathIsDirectory(destPath.c_str())) { + DirectoryUtil::createDirectories(destPath.c_str()); + } + if (!::CopyFile(src.c_str(), dest.c_str(), _failIfExists)) { status = STEPSTATUS_NEEDGPUP; @@ -323,21 +329,14 @@ StepStatus CopyStep::copyDirectory(tstring& fromPath, tstring& toPath, copyElement->SetAttribute(_T("from"), src.c_str()); - if (_toDestination == TO_DIRECTORY) - copyElement->SetAttribute(_T("to"), _to.c_str()); - else if (_toDestination == TO_FILE) - copyElement->SetAttribute(_T("toFile"), _toFile.c_str()); + copyElement->SetAttribute(_T("toFile"), dest.c_str()); copyElement->SetAttribute(_T("replace"), _T("true")); if (_backup) copyElement->SetAttribute(_T("backup"), _T("true")); - if (_recursive) { - copyElement->SetAttribute(_T("recursive"), _T("true")); - } - if (_validate) { - copyElement->SetAttribute(_T("recursive"), _T("true")); + copyElement->SetAttribute(_T("validate"), _T("true")); } forGpup->LinkEndChild(copyElement);