From 9aef43181855256b7b6690aa2422769198c3aecf Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sat, 11 Apr 2020 09:58:42 +0200 Subject: [PATCH] WebSockets: move diskPath property to surfaces group object --- libs/surfaces/websockets/manifest.cc | 3 +-- libs/surfaces/websockets/resources.cc | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libs/surfaces/websockets/manifest.cc b/libs/surfaces/websockets/manifest.cc index 3279f408b0..85407a231d 100644 --- a/libs/surfaces/websockets/manifest.cc +++ b/libs/surfaces/websockets/manifest.cc @@ -73,8 +73,7 @@ SurfaceManifest::to_json () std::stringstream ss; ss << "{" - << "\"diskPath\":\"" << _path << "\"" - << ",\"path\":\"" << Glib::path_get_basename (_path) << "\"" + << "\"path\":\"" << Glib::path_get_basename (_path) << "\"" << ",\"name\":\"" << _name << "\"" << ",\"description\":\"" << _description << "\"" << "}"; diff --git a/libs/surfaces/websockets/resources.cc b/libs/surfaces/websockets/resources.cc index 428128638a..67fc12017f 100644 --- a/libs/surfaces/websockets/resources.cc +++ b/libs/surfaces/websockets/resources.cc @@ -80,9 +80,14 @@ ServerResources::scan () { std::stringstream ss; - ss << "[{\"path\":\"" << builtin_dir_name << "\",\"surfaces\":["; + std::string builtin_dir_str = builtin_dir (); + SurfaceManifestVector builtin = read_manifests (builtin_dir_str); - SurfaceManifestVector builtin = read_manifests (builtin_dir ()); + ss << "[{" + << "\"diskPath\":\"" << builtin_dir_str << "\"" + << ",\"path\":\"" << builtin_dir_name << "\"" + << ",\"surfaces\":" + << "["; for (SurfaceManifestVector::iterator it = builtin.begin (); it != builtin.end (); ) { ss << it->to_json (); @@ -91,9 +96,14 @@ ServerResources::scan () } } - ss << "]},{\"path\":\"" << user_dir_name << "\",\"surfaces\":["; + std::string user_dir_str = user_dir (); + SurfaceManifestVector user = read_manifests (user_dir_str); - SurfaceManifestVector user = read_manifests (user_dir ()); + ss << "]},{" + << "\"diskPath\":\"" << user_dir_str << "\"" + << ",\"path\":\"" << user_dir_name << "\"" + << ",\"surfaces\":" + << "["; for (SurfaceManifestVector::iterator it = user.begin (); it != user.end (); ) { ss << it->to_json ();