Added list of image files to protobuf interface

This commit is contained in:
Uwe Seimet 2021-08-04 15:18:28 +02:00
parent 777b85d4ad
commit 5ddd177ff6
2 changed files with 14 additions and 2 deletions

View File

@ -477,8 +477,8 @@ void LogDeviceList(const string& device_list)
set<string> GetAvailableImages() {
set<string> available_images;
for (const auto & entry : filesystem::directory_iterator(default_image_folder)) {
available_images.insert(entry.path());
for (const auto& entry : filesystem::directory_iterator(default_image_folder)) {
available_images.insert(entry.path().filename());
}
return available_images;
@ -889,6 +889,13 @@ static void *MonThread(void *param)
PbServerInfo serverInfo;
serverInfo.set_rascsi_version(rascsi_get_version_string());
serverInfo.set_log_level(spdlog_log_level);
serverInfo.set_default_image_folder(default_image_folder);
set<string> available_images = GetAvailableImages();
set<string>::iterator it = available_images.begin();
while (it != available_images.end()) {
serverInfo.add_available_images(*it);
it++;
}
SerializeMessage(fd, serverInfo);
}
else {

View File

@ -179,6 +179,11 @@ void CommandServerInfo(const string& hostname, int port)
cout << "rascsi version: " << serverInfo.rascsi_version() << endl;
cout << "rascsi log level: " << serverInfo.log_level() << endl;
cout << "Default image folder: " << serverInfo.default_image_folder() << endl;
cout << "Available image files:" << endl;
for (int i = 0; i < serverInfo.available_images_size(); i++) {
cout << " " << serverInfo.available_images(i) << endl;
}
}
//---------------------------------------------------------------------------