13
0

WebSockets: move diskPath property to surfaces group object

This commit is contained in:
Luciano Iam 2020-04-11 09:58:42 +02:00 committed by Robin Gareus
parent ad363d12a2
commit 9aef431818
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 15 additions and 6 deletions

View File

@ -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 << "\""
<< "}";

View File

@ -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 ();