Skip to content

Commit

Permalink
Merge pull request #55 from bruderstein/fix-copystep
Browse files Browse the repository at this point in the history
Fix copystep when run via gpup
  • Loading branch information
bruderstein authored Apr 10, 2017
2 parents 7fc9593 + a4a2e3f commit fb2ea2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*.vcproj.user
*.vcproj.*.user
*.vcxproj.user
*.opendb
*.db
BuildLog.htm
doc/Thumbs.db
Debug/
Expand Down
17 changes: 8 additions & 9 deletions libinstall/src/CopyStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit fb2ea2e

Please sign in to comment.