From e4d3c3b0458b141df5d3cfadcd980ec6f0240ac4 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Mon, 3 Dec 2018 17:19:44 -0800 Subject: [PATCH] Field name fix, clean up project paths --- server/src/rbx_session.rs | 9 +++++++-- server/src/web.rs | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/rbx_session.rs b/server/src/rbx_session.rs index 705a6ecd..3fc2fd4b 100644 --- a/server/src/rbx_session.rs +++ b/server/src/rbx_session.rs @@ -198,7 +198,7 @@ fn construct_initial_tree( construct_project_node( &mut context, None, - &project.name, + "", &project.name, &project.tree, ); @@ -258,7 +258,12 @@ fn construct_instance_node( let id = insert_or_create_tree(context, parent_instance_id, instance); for (child_name, child_project_node) in &project_node.children { - let child_path = format!("{}/{}", instance_path, child_name); + let child_path = if instance_path.is_empty() { + child_name.clone() + } else { + format!("{}/{}", instance_path, child_name) + }; + construct_project_node(context, Some(id), &child_path, child_name, child_project_node); } diff --git a/server/src/web.rs b/server/src/web.rs index bae32228..c367dabd 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -27,7 +27,7 @@ pub struct ServerInfoResponse<'a> { pub protocol_version: u64, pub root_instance_id: RbxId, pub project: Cow<'a, Project>, - pub project_paths_to_ids: Cow<'a, HashMap>, + pub ids_to_project_paths: Cow<'a, HashMap>, } #[derive(Debug, Serialize, Deserialize)] @@ -80,7 +80,7 @@ impl Server { session_id: self.session.session_id, root_instance_id: tree.get_root_id(), project: Cow::Borrowed(&self.session.project), - project_paths_to_ids: Cow::Borrowed(rbx_session.get_project_path_map()), + ids_to_project_paths: Cow::Borrowed(rbx_session.get_project_path_map()), }) },