diff options
3 files changed, 9 insertions, 5 deletions
diff --git a/backends/networking/sdl_net/handlers/filesbasehandler.cpp b/backends/networking/sdl_net/handlers/filesbasehandler.cpp index 5e5787b624..135e0fb100 100644 --- a/backends/networking/sdl_net/handlers/filesbasehandler.cpp +++ b/backends/networking/sdl_net/handlers/filesbasehandler.cpp @@ -50,9 +50,9 @@ bool FilesBaseHandler::transformPath(Common::String &path, Common::String &prefi if (isDirectory && path.lastChar() != '/' && path.lastChar() != '\\') path += '/'; - if (path.hasPrefix("/root")) { + if (path.hasPrefix("/root") && ConfMan.hasKey("rootpath", "cloud")) { prefixToAdd = "/root/"; - prefixToRemove = (ConfMan.hasKey("rootpath", "cloud") ? ConfMan.get("rootpath", "cloud") : ""); + prefixToRemove = ConfMan.get("rootpath", "cloud"); if (prefixToRemove.size() && prefixToRemove.lastChar() != '/' && prefixToRemove.lastChar() != '\\') prefixToRemove += '/'; if (prefixToRemove == "/") prefixToRemove = ""; diff --git a/backends/networking/sdl_net/handlers/filespagehandler.cpp b/backends/networking/sdl_net/handlers/filespagehandler.cpp index 0bc9237805..e117b4922c 100644 --- a/backends/networking/sdl_net/handlers/filespagehandler.cpp +++ b/backends/networking/sdl_net/handlers/filespagehandler.cpp @@ -23,6 +23,7 @@ #include "backends/networking/sdl_net/handlers/filespagehandler.h" #include "backends/networking/sdl_net/handlerutils.h" #include "backends/networking/sdl_net/localwebserver.h" +#include "common/config-manager.h" #include "common/translation.h" namespace Networking { @@ -76,7 +77,8 @@ Common::String getDisplayPath(Common::String s) { bool FilesPageHandler::listDirectory(Common::String path, Common::String &content, const Common::String &itemTemplate) { if (path == "" || path == "/") { - addItem(content, itemTemplate, IT_DIRECTORY, "/root/", _("File system root")); + if (ConfMan.hasKey("rootpath", "cloud")) + addItem(content, itemTemplate, IT_DIRECTORY, "/root/", _("File system root")); addItem(content, itemTemplate, IT_DIRECTORY, "/saves/", _("Saved games")); return true; } diff --git a/backends/networking/sdl_net/handlers/listajaxhandler.cpp b/backends/networking/sdl_net/handlers/listajaxhandler.cpp index 57fa04d10d..f94b674a3c 100644 --- a/backends/networking/sdl_net/handlers/listajaxhandler.cpp +++ b/backends/networking/sdl_net/handlers/listajaxhandler.cpp @@ -23,8 +23,9 @@ #include "backends/networking/sdl_net/handlers/listajaxhandler.h" #include "backends/networking/sdl_net/handlerutils.h" #include "backends/networking/sdl_net/localwebserver.h" -#include "common/translation.h" +#include "common/config-manager.h" #include "common/json.h" +#include "common/translation.h" namespace Networking { @@ -40,7 +41,8 @@ Common::JSONObject ListAjaxHandler::listDirectory(Common::String path) { errorResult.setVal("type", new Common::JSONValue("error")); if (path == "" || path == "/") { - addItem(itemsList, IT_DIRECTORY, "/root/", _("File system root")); + if (ConfMan.hasKey("rootpath", "cloud")) + addItem(itemsList, IT_DIRECTORY, "/root/", _("File system root")); addItem(itemsList, IT_DIRECTORY, "/saves/", _("Saved games")); successResult.setVal("items", new Common::JSONValue(itemsList)); return successResult; |