aboutsummaryrefslogtreecommitdiff
path: root/backends/networking
diff options
context:
space:
mode:
authorAlexander Tkachev2016-08-01 16:00:06 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit8a1cca896eedd37e3926cc036fc00e659719e613 (patch)
tree5fc02a34b0b4f18b8aea164950ca60b4f07217b2 /backends/networking
parentfaf849012cd431e9d4dbdbe7a3c1ebf514d3f5c8 (diff)
downloadscummvm-rg350-8a1cca896eedd37e3926cc036fc00e659719e613.tar.gz
scummvm-rg350-8a1cca896eedd37e3926cc036fc00e659719e613.tar.bz2
scummvm-rg350-8a1cca896eedd37e3926cc036fc00e659719e613.zip
CLOUD: Update handlers
Now if there is no "rootpath" specified, it's not even listed by FilesPageHandler and ListAjaxHandler. And, of course, not available to use anywhere else.
Diffstat (limited to 'backends/networking')
-rw-r--r--backends/networking/sdl_net/handlers/filesbasehandler.cpp4
-rw-r--r--backends/networking/sdl_net/handlers/filespagehandler.cpp4
-rw-r--r--backends/networking/sdl_net/handlers/listajaxhandler.cpp6
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;