if(WIN32)
set(sak_endl "\r\n")
else()
set(sak_endl "\n")
endif()
# config.xml
set(config_file ${ROOT_DIR}/config/config.xml)
set(target_dir "@HomeDir@/AppData/Roaming/Qsaker")
file(WRITE ${config_file} "${sak_endl}")
file(APPEND ${config_file} "${sak_endl}")
file(APPEND ${config_file} " ${TARGET}${sak_endl}")
file(APPEND ${config_file} " ${VERSION}${sak_endl}")
file(APPEND ${config_file} " ${TARGET}${sak_endl}")
file(APPEND ${config_file} " Qsaker${sak_endl}")
file(APPEND ${config_file} " Qsaker/${TARGET}${sak_endl}")
file(APPEND ${config_file} " ${target_dir}/${TARGET}${sak_endl}")
file(APPEND ${config_file} " false${sak_endl}")
file(APPEND ${config_file} " 420${sak_endl}")
file(APPEND ${config_file} "")
# package.xml
set(package_file ${ROOT_DIR}/packages/${TARGET}/meta/package.xml)
string(TIMESTAMP PACKING_DATE %Y-%m-%d)
file(WRITE ${package_file} "${sak_endl}")
file(APPEND ${package_file} "${sak_endl}")
file(APPEND ${package_file} " EasyDebug${sak_endl}")
file(APPEND ${package_file} " Installer ${TARGET}${sak_endl}")
file(APPEND ${package_file} " ${VERSION}${sak_endl}")
file(APPEND ${package_file} " ${sak_endl}")
file(APPEND ${package_file} " ${PACKING_DATE}${sak_endl}")
file(APPEND ${package_file} " true${sak_endl}")
file(APPEND ${package_file} " true${sak_endl}")
file(APPEND ${package_file} "${sak_endl}")
# installscript.qs
set(script_file ${ROOT_DIR}/packages/${TARGET}/meta/installscript.qs)
file(WRITE ${script_file} "function Component() {}${sak_endl}")
file(APPEND ${script_file} "Component.prototype.createOperations = function() {${sak_endl}")
file(APPEND ${script_file} "component.createOperations();${sak_endl}")
file(APPEND ${script_file} " if (systemInfo.productType === \"windows\") {${sak_endl}")
file(APPEND ${script_file} " component.addOperation(\"CreateShortcut\",${sak_endl}")
file(APPEND ${script_file} " \"@TargetDir@/${TARGET}.exe\",${sak_endl}")
file(APPEND ${script_file} " \"@StartMenuDir@/${TARGET}.lnk\",${sak_endl}")
file(APPEND ${script_file} " \"workingDirectory=@TargetDir@\",${sak_endl}")
file(APPEND ${script_file} " \"iconPath=@TargetDir@/icon.ico\",${sak_endl}")
file(APPEND ${script_file} " \"description=Open ${TARGET} Program\");${sak_endl}")
file(APPEND ${script_file} " component.addOperation(\"CreateShortcut\",${sak_endl}")
file(APPEND ${script_file} " \"@TargetDir@/${TARGET}.exe\",${sak_endl}")
file(APPEND ${script_file} " \"@DesktopDir@/${TARGET}.lnk\",${sak_endl}")
file(APPEND ${script_file} " \"workingDirectory=@TargetDir@\",${sak_endl}")
file(APPEND ${script_file} " \"iconPath=@TargetDir@/icon.ico\",${sak_endl}")
file(APPEND ${script_file} " \"description=Open ${TARGET} Program\");${sak_endl}")
file(APPEND ${script_file} " component.addOperation(\"CreateShortcut\",${sak_endl}")
file(APPEND ${script_file} " \"@TargetDir@/maintenancetool.exe\",${sak_endl}")
file(APPEND ${script_file} " \"@StartMenuDir@/${TARGET} Uninstaller.lnk\",${sak_endl}")
file(APPEND ${script_file} " \"workingDirectory=@TargetDir@\",${sak_endl}")
file(APPEND ${script_file} " \"iconPath=%SystemRoot%/system32/SHELL32.dll\",${sak_endl}")
file(APPEND ${script_file} " \"iconId=101\",${sak_endl}")
file(APPEND ${script_file} " \"description=Uninstall ${TARGET} Program\",${sak_endl}")
file(APPEND ${script_file} " \"--start-uninstaller\");${sak_endl}")
file(APPEND ${script_file} " }${sak_endl}")
file(APPEND ${script_file} "}${sak_endl}")