From 14c8005ff7908d5a16e9db584e5eb2c4d98414f3 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Tue, 13 Aug 2024 12:36:18 +0200 Subject: [PATCH] Changed the database locator code to also build in debug mode. Moved the single debug build flag into a variable. --- Duplicati/Server/Program.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Duplicati/Server/Program.cs b/Duplicati/Server/Program.cs index 7bd94d8db..8da009c68 100644 --- a/Duplicati/Server/Program.cs +++ b/Duplicati/Server/Program.cs @@ -40,6 +40,12 @@ namespace Duplicati.Server private static readonly List ParameterFileOptionStrings = new List { "parameters-file", "parameterfile" }; +#if DEBUG + private const bool DEBUG_MODE = true; +#else + private const bool DEBUG_MODE = false; +#endif + /// /// The log tag for messages from this class /// @@ -580,13 +586,16 @@ namespace Duplicati.Server if (string.IsNullOrEmpty(serverDataFolder)) { -#if DEBUG - //debug mode uses a lock file located in the app folder - DataFolder = StartupPath; -#else - bool portableMode = commandlineOptions.ContainsKey("portable-mode") ? Library.Utility.Utility.ParseBool(commandlineOptions["portable-mode"], true) : false; + bool portableMode = commandlineOptions.ContainsKey("portable-mode") + ? Library.Utility.Utility.ParseBool(commandlineOptions["portable-mode"], true) + : (DEBUG_MODE ? true : false); // Default to portable mode in debug mode - if (portableMode) + if (DEBUG_MODE && portableMode) + { + //debug mode uses a lock file located in the app folder + DataFolder = StartupPath; + } + else if (portableMode) { //Portable mode uses a data folder in the application home dir DataFolder = System.IO.Path.Combine(StartupPath, "data"); @@ -641,7 +650,6 @@ namespace Duplicati.Server DataFolder = serverDataFolder; } -#endif } else DataFolder = Util.AppendDirSeparator(Environment.ExpandEnvironmentVariables(serverDataFolder).Trim('"'));