From a056e631e4aef9150885002faf55ecea5762ebd4 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Mon, 22 Aug 2011 19:05:31 +0100 Subject: [PATCH] Adjust the filename of the main app binary to app.exe in the test file_list.xml on Windows --- src/tests/file_list.xml | 2 +- src/tests/test-update.rb | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/tests/file_list.xml b/src/tests/file_list.xml index 97e57b3..e4344fd 100644 --- a/src/tests/file_list.xml +++ b/src/tests/file_list.xml @@ -17,7 +17,7 @@ - app + $APP_FILENAME $UPDATED_APP_HASH $UPDATED_APP_SIZE 30549 diff --git a/src/tests/test-update.rb b/src/tests/test-update.rb index 1698792..3041987 100755 --- a/src/tests/test-update.rb +++ b/src/tests/test-update.rb @@ -11,6 +11,20 @@ APP_NAME = "app.exe" UPDATER_NAME = "updater.exe" ZIP_TOOL = "C:/Cygwin/bin/zip.exe" +file_list_vars = { + "APP_FILENAME" => APP_NAME +} + +def replace_vars(src_file,dest_file,vars) + content = File.read(src_file) + vars.each do |key,value| + content.gsub! "$#{key}",value + end + File.open(dest_file,'w') do |file| + file.print content + end +end + # Remove the install and package dirs if they # already exist FileUtils.rm_rf(INSTALL_DIR) @@ -34,7 +48,7 @@ FileUtils.rm("#{PACKAGE_DIR}/#{APP_NAME}") # Copy the install script and updater to the target # directory -FileUtils.cp("file_list.xml","#{PACKAGE_DIR}/file_list.xml") +replace_vars("file_list.xml","#{PACKAGE_DIR}/file_list.xml",file_list_vars) FileUtils.cp("../#{UPDATER_NAME}","#{PACKAGE_DIR}/#{UPDATER_NAME}") # Run the updater using the new syntax