From b82acee8a3eea560fccde15b3eecb9e518f40bdd Mon Sep 17 00:00:00 2001 From: "kenneth@hexad.dk" Date: Sat, 31 Mar 2012 17:44:21 +0000 Subject: [PATCH] Simplified debugging of web server with html changes git-svn-id: https://duplicati.googlecode.com/svn/trunk@1196 59da171f-624f-0410-aa54-27559c288bec --- Duplicati/Server/Duplicati.Server.csproj | 64 +++++++++++++----------- Duplicati/Server/WebServer.cs | 18 ++++++- 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/Duplicati/Server/Duplicati.Server.csproj b/Duplicati/Server/Duplicati.Server.csproj index c4202665c..2a680cc1d 100644 --- a/Duplicati/Server/Duplicati.Server.csproj +++ b/Duplicati/Server/Duplicati.Server.csproj @@ -129,48 +129,54 @@ - + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - + + PreserveNewest - - - - - + + PreserveNewest - + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/Duplicati/Server/WebServer.cs b/Duplicati/Server/WebServer.cs index 3456573c6..b9a22d431 100644 --- a/Duplicati/Server/WebServer.cs +++ b/Duplicati/Server/WebServer.cs @@ -22,7 +22,23 @@ namespace Duplicati.Server m_server.Add(new DynamicHandler()); - FileModule fh = new FileModule("/", System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "webroot")); + string webroot = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); +#if DEBUG + //For debug we go "../../../.." to get out of "GUI/Duplicati.GUI.TrayIcon/bin/debug" + string tmpwebroot = System.IO.Path.GetFullPath(System.IO.Path.Combine(webroot, "..", "..", "..", "..")); + tmpwebroot = System.IO.Path.Combine(tmpwebroot, "Server"); + if (System.IO.Directory.Exists(System.IO.Path.Combine(tmpwebroot, "webroot"))) + webroot = tmpwebroot; + else + { + //If we are running the server standalone, we only need to exit "bin/Debug" + tmpwebroot = System.IO.Path.GetFullPath(System.IO.Path.Combine(webroot, "..", "..")); + if (System.IO.Directory.Exists(System.IO.Path.Combine(tmpwebroot, "webroot"))) + webroot = tmpwebroot; + } + +#endif + FileModule fh = new FileModule("/", System.IO.Path.Combine(webroot, "webroot")); fh.AddDefaultMimeTypes(); m_server.Add(fh);