@@ -189,30 +189,6 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index
189189 }
190190}
191191
192- static inline bool isMatchFolders (FFstrbuf * folders , const FFstrbuf * path , char separator )
193- {
194- #ifndef _WIN32
195- uint32_t startIndex = 0 ;
196- while (startIndex < folders -> length )
197- {
198- uint32_t colonIndex = ffStrbufNextIndexC (folders , startIndex , separator );
199-
200- char savedColon = folders -> chars [colonIndex ]; // Can be '\0' if at end
201- folders -> chars [colonIndex ] = '\0' ;
202-
203- bool matched = fnmatch (& folders -> chars [startIndex ], path -> chars , 0 ) == 0 ;
204- folders -> chars [colonIndex ] = savedColon ;
205-
206- if (matched ) return true;
207-
208- startIndex = colonIndex + 1 ;
209- }
210- return false;
211- #else
212- return ffStrbufSeparatedContain (folders , path , separator );
213- #endif
214- }
215-
216192bool ffPrintDisk (FFDiskOptions * options )
217193{
218194 FF_LIST_AUTO_DESTROY disks = ffListCreate (sizeof (FFDisk ));
@@ -224,18 +200,18 @@ bool ffPrintDisk(FFDiskOptions* options)
224200 return false;
225201 }
226202
203+ if (disks .length == 0 )
204+ {
205+ ffPrintError (FF_DISK_MODULE_NAME , 0 , & options -> moduleArgs , FF_PRINT_TYPE_DEFAULT , "No disks found" );
206+ return false;
207+ }
208+
227209 uint32_t index = 0 ;
228210 FF_LIST_FOR_EACH (FFDisk , disk , disks )
229211 {
230212 if (__builtin_expect (options -> folders .length == 0 , 1 ) && (disk -> type & ~options -> showTypes ))
231213 continue ;
232214
233- if (options -> hideFolders .length && isMatchFolders (& options -> hideFolders , & disk -> mountpoint , FF_DISK_FOLDER_SEPARATOR ))
234- continue ;
235-
236- if (options -> hideFS .length && ffStrbufSeparatedContain (& options -> hideFS , & disk -> filesystem , ':' ))
237- continue ;
238-
239215 printDisk (options , disk , ++ index );
240216 }
241217
@@ -407,7 +383,7 @@ bool ffGenerateDiskJsonResult(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
407383
408384 if (error )
409385 {
410- yyjson_mut_obj_add_str (doc , module , "result " , error );
386+ yyjson_mut_obj_add_str (doc , module , "error " , error );
411387 return false;
412388 }
413389
0 commit comments