| 37 | |
| 38 | |
| 39 | std::shared_ptr<InstallStep> InstallStepFactory::create(TiXmlElement* element) |
| 40 | { |
| 41 | std::shared_ptr<InstallStep> installStep; |
| 42 | |
| 43 | if (!_tcscmp(element->Value(), _T("download")) && element->FirstChild()) |
| 44 | { |
| 45 | installStep.reset(new DownloadStep(element->FirstChild()->Value(), element->Attribute(_T("filename")))); |
| 46 | } |
| 47 | else if (!_tcscmp(element->Value(), _T("copy"))) |
| 48 | { |
| 49 | const TCHAR *tFrom = element->Attribute(_T("from")); |
| 50 | const TCHAR *tTo = element->Attribute(_T("to")); |
| 51 | const TCHAR *tToFile = element->Attribute(_T("toFile")); |
| 52 | |
| 53 | const TCHAR *tReplace = element->Attribute(_T("replace")); |
| 54 | const TCHAR *tValidate = element->Attribute(_T("validate")); |
| 55 | const TCHAR *tBackup = element->Attribute(_T("backup")); |
| 56 | const TCHAR *tIsGpup = element->Attribute(_T("isGpup")); |
| 57 | const TCHAR *tRecursive = element->Attribute(_T("recursive")); |
| 58 | |
| 59 | BOOL attemptReplace = FALSE; |
| 60 | BOOL validate = FALSE; |
| 61 | BOOL backup = FALSE; |
| 62 | BOOL isGpup = FALSE; |
| 63 | BOOL recursive = FALSE; |
| 64 | |
| 65 | if (tReplace && !_tcscmp(tReplace, _T("true"))) |
| 66 | attemptReplace = TRUE; |
| 67 | |
| 68 | if (tValidate && !_tcscmp(tValidate, _T("true"))) |
| 69 | validate = TRUE; |
| 70 | |
| 71 | if (tBackup && !_tcscmp(tBackup, _T("true"))) |
| 72 | backup = TRUE; |
| 73 | |
| 74 | if (tIsGpup && !_tcscmp(tIsGpup, _T("true"))) |
| 75 | isGpup = TRUE; |
| 76 | |
| 77 | if (tRecursive && !_tcscmp(tRecursive, _T("true"))) |
| 78 | recursive = TRUE; |
| 79 | |
| 80 | tstring validateUrl; |
| 81 | if (_variableHandler) { |
| 82 | validateUrl = _variableHandler->getVariable(VALIDATE_BASE_URL_VAR); |
| 83 | } |
| 84 | installStep.reset(new CopyStep(tFrom, tTo, tToFile, attemptReplace, validate, isGpup, backup, recursive, validateUrl)); |
| 85 | } |
| 86 | else if (!_tcscmp(element->Value(), _T("delete"))) |
| 87 | { |
| 88 | const TCHAR *tFile = element->Attribute(_T("file")); |
| 89 | |
| 90 | // If no file attribute specified, just return a null step |
| 91 | if (!tFile) |
| 92 | return installStep; |
| 93 | |
| 94 | BOOL isDirectory = FALSE; |
| 95 | |
| 96 | const TCHAR *tIsDir = element->Attribute(_T("isDirectory")); |
nothing calls this directly
no test coverage detected