From 0d929f4042cfc566c405e0829cd1ddaf67f8b348 Mon Sep 17 00:00:00 2001 From: Christopher Lees Date: Wed, 22 Jun 2016 13:44:24 +0100 Subject: [PATCH] Fix: The language file wasn't loaded quite soon enough. Fix: The program would crash if no language files were present. It now shows an appropriate error dialog. Fix: The InnoSetup installer wasn't creating the Data folder properly --- .travis.yml | 4 ++-- WindowsInstaller/openbve.iss | 4 ++-- openBVE/OpenBve/System/Program.cs | 27 ++++++++++++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 650d8e5d7..3609df985 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,8 +33,8 @@ after_success: - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && test "$TRAVIS_OS_NAME" == "osx" && hdiutil create OpenBVE-$(date '+%F').dmg -volname "OpenBVE" -fs HFS+ -srcfolder "OpenBVE.app" - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && test "$TRAVIS_OS_NAME" == "osx" && sshpass -e scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "OpenBVE-$(date '+%F').dmg" $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH #Release build - - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_TAG && test "$TRAVIS_OS_NAME" == "osx" && hdiutil create openBVE-$($TRAVIS_TAG).dmg -volname "openBVE" -fs HFS+ -srcfolder "OpenBVE.app" - - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_TAG && test "$TRAVIS_OS_NAME" == "osx" && sshpass -e scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "openBVE-$($TRAVIS_TAG).dmg" $DEPLOY_USER@$DEPLOY_HOST:$RELEASE_PATH + - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_TAG && test "$TRAVIS_OS_NAME" == "osx" && hdiutil create openBVE-$TRAVIS_TAG.dmg -volname "openBVE" -fs HFS+ -srcfolder "OpenBVE.app" + - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_TAG && test "$TRAVIS_OS_NAME" == "osx" && sshpass -e scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "openBVE-$TRAVIS_TAG.dmg" $DEPLOY_USER@$DEPLOY_HOST:$RELEASE_PATH addons: apt: packages: diff --git a/WindowsInstaller/openbve.iss b/WindowsInstaller/openbve.iss index d4fa4ac5c..1cd6f75c1 100644 --- a/WindowsInstaller/openbve.iss +++ b/WindowsInstaller/openbve.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "openBVE" -#define MyAppVersion "1.5.0.1" +#define MyAppVersion "1.5.0.2" #define MyAppPublisher "Christopher Lees" #define MyAppURL "http://www.openbve-project.net" #define MyAppExeName "OpenBve.exe" @@ -46,7 +46,7 @@ Source: "C:\Program Files (x86)\openBVE\OpenBveApi.xml"; DestDir: "{app}"; Flags Source: "C:\Program Files (x86)\openBVE\OpenTK.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\Program Files (x86)\openBVE\OpenTK.dll.config"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\Program Files (x86)\openBVE\SharpCompress.Unsigned.dll"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\Program Files (x86)\openBVE\Data\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "C:\Program Files (x86)\openBVE\Data\*"; DestDir: "{app}\Data"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/openBVE/OpenBve/System/Program.cs b/openBVE/OpenBve/System/Program.cs index 70f33e99d..ea961064a 100644 --- a/openBVE/OpenBve/System/Program.cs +++ b/openBVE/OpenBve/System/Program.cs @@ -131,6 +131,23 @@ private static void Main(string[] args) { options.Backend = PlatformBackend.PreferNative; } Toolkit.Init(options); + // --- load language --- + { + string folder = Program.FileSystem.GetDataFolder("Languages"); + try + { + string[] LanguageFiles = Directory.GetFiles(folder, "*.cfg"); + foreach (var File in LanguageFiles) + { + Interface.AddLanguage(File); + } + } + catch + { + MessageBox.Show(@"An error occured whilst attempting to load the default language files."); + //Environment.Exit(0); + } + } Interface.LoadControls(null, out Interface.CurrentControls); { string folder = Program.FileSystem.GetDataFolder("Controls"); @@ -139,15 +156,7 @@ private static void Main(string[] args) { Interface.LoadControls(file, out controls); Interface.AddControls(ref Interface.CurrentControls, controls); } - // --- load language --- - { - string folder = Program.FileSystem.GetDataFolder("Languages"); - string[] LanguageFiles = Directory.GetFiles(folder, "*.cfg"); - foreach (var File in LanguageFiles) - { - Interface.AddLanguage(File); - } - } + // --- check the command-line arguments for route and train --- formMain.MainDialogResult result = new formMain.MainDialogResult(); for (int i = 0; i < args.Length; i++) {