Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions service/project/src/projectservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ void ProjectServiceHandler::getRootFiles(std::vector<FileInfo>& return_)
return_.push_back(makeFileInfo(f));
}
});

std::sort(return_.begin(), return_.end(), fileInfoOrder);
}

void ProjectServiceHandler::getChildFiles(
Expand Down
5 changes: 5 additions & 0 deletions service/workspace/include/workspaceservice/workspaceservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class WorkspaceServiceHandler : virtual public WorkspaceServiceIf
void getWorkspaces(std::vector<WorkspaceInfo>& _return) override;

private:
/**
* This function defines an ordering between WorkspaceInfo objects by name.
*/
static bool workspaceInfoOrder(const WorkspaceInfo& left, const WorkspaceInfo& right);

std::string _workspace;
};

Expand Down
13 changes: 11 additions & 2 deletions service/workspace/src/workspaceservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WorkspaceServiceHandler::WorkspaceServiceHandler(const std::string& workspace_)
{
}

void WorkspaceServiceHandler::getWorkspaces(std::vector<WorkspaceInfo>& _return)
void WorkspaceServiceHandler::getWorkspaces(std::vector<WorkspaceInfo>& return_)
{
namespace fs = boost::filesystem;

Expand All @@ -35,8 +35,17 @@ void WorkspaceServiceHandler::getWorkspaces(std::vector<WorkspaceInfo>& _return)
info.id = filename;
info.description = filename;

_return.push_back(std::move(info));
return_.push_back(std::move(info));
}

std::sort(return_.begin(), return_.end(), workspaceInfoOrder);
}

bool WorkspaceServiceHandler::workspaceInfoOrder(
const WorkspaceInfo& left_,
const WorkspaceInfo& right_)
{
return left_.id < right_.id;
}

} // workspace
Expand Down