@@ -53,7 +53,9 @@ int handle_request(int argc, char** argv)
5353 std::string mode=argv[1 ];
5454 if (mode == " info" ){
5555 libConfig::Bundle b;
56- b.initialize (false );
56+ if (!b.initialize (false )){
57+ return EXIT_FAILURE;
58+ }
5759 std::cout << " Active bundles: " << str (b.getActiveBundleNames ()) << std::endl;
5860 std::cout << " Available bundles: " << std::endl;
5961 for (const libConfig::SingleBundle& sb : b.getAvailableBundles ())
@@ -66,21 +68,27 @@ int handle_request(int argc, char** argv)
6668 else if (mode == " selected" )
6769 {
6870 libConfig::Bundle b;
69- b.initialize (false );
71+ if (!b.initialize (false )){
72+ return EXIT_FAILURE;
73+ }
7074 std::cout << b.getActiveBundles ()[0 ].name << std::endl;
7175 return EXIT_SUCCESS;
7276 }
7377 else if (mode == " selectedpath" )
7478 {
7579 libConfig::Bundle b;
76- b.initialize (false );
80+ if (!b.initialize (false )){
81+ return EXIT_FAILURE;
82+ }
7783 std::cout << b.getActiveBundles ()[0 ].path << std::endl;
7884 return EXIT_SUCCESS;
7985 }
8086 else if (mode == " active" )
8187 {
8288 libConfig::Bundle b;
83- b.initialize (false );
89+ if (!b.initialize (false )){
90+ return EXIT_FAILURE;
91+ }
8492 for (const libConfig::SingleBundle& sb : b.getActiveBundles ()){
8593 std::cout << sb.name << std::endl;
8694 }
@@ -93,7 +101,9 @@ int handle_request(int argc, char** argv)
93101 return EXIT_FAILURE;
94102 }
95103 libConfig::Bundle b;
96- b.initialize (false );
104+ if (!b.initialize (false )){
105+ return EXIT_FAILURE;
106+ }
97107 std::vector<std::string> res = b.findFilesByName (argv[2 ]);
98108 for (const std::string& p : res){
99109 std::cout << p << std::endl;
@@ -106,7 +116,9 @@ int handle_request(int argc, char** argv)
106116 return EXIT_FAILURE;
107117 }
108118 libConfig::Bundle b;
109- b.initialize (false );
119+ if (!b.initialize (false )){
120+ return EXIT_FAILURE;
121+ }
110122 std::cout << b.findFileByName (argv[2 ]) << std::endl;
111123 }
112124 else if (mode == " findext" )
@@ -131,10 +143,15 @@ int handle_request(int argc, char** argv)
131143 return EXIT_FAILURE;
132144 }
133145 libConfig::Bundle b;
134- b.initialize (false );
135- std::vector<std::string> res = b.findFilesByExtension (rel_path, ext);
136- for (const std::string& p : res){
137- std::cout << p << std::endl;
146+ if (!b.initialize (false ))
147+ {
148+ return EXIT_FAILURE;
149+ }
150+ else {
151+ std::vector<std::string> res = b.findFilesByExtension (rel_path, ext);
152+ for (const std::string& p : res){
153+ std::cout << p << std::endl;
154+ }
138155 }
139156 }
140157 else
0 commit comments