MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / DeleteFile

Function DeleteFile

rEFIt_UEFI/refit/lib.cpp:1352–1388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350}
1351
1352BOOLEAN DeleteFile(IN EFI_FILE *Root, IN CONST CHAR16 *RelativePath)
1353{
1354 EFI_STATUS Status;
1355 EFI_FILE *File;
1356 EFI_FILE_INFO *FileInfo;
1357
1358 //DBG("DeleteFile: %ls\n", RelativePath);
1359 // open file for read/write to see if it exists, need write for delete
1360 Status = Root->Open(Root, &File, RelativePath, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
1361 //DBG(" Open: %s\n", efiStrError(Status));
1362 if (Status == EFI_SUCCESS) {
1363 // exists - check if it is a file
1364 FileInfo = EfiLibFileInfo(File);
1365 if (FileInfo == NULL) {
1366 // error
1367 //DBG(" FileInfo is NULL\n");
1368 File->Close(File);
1369 return FALSE;
1370 }
1371 //DBG(" FileInfo attr: %hhX\n", FileInfo->Attribute);
1372 if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) {
1373 // it's directory - return error
1374 //DBG(" File is DIR\n");
1375 FreePool(FileInfo);
1376 File->Close(File);
1377 return FALSE;
1378 }
1379 FreePool(FileInfo);
1380 // it's a file - delete it
1381 //DBG(" File is file\n");
1382 Status = File->Delete(File);
1383 //DBG(" Delete: %s\n", efiStrError(Status));
1384
1385 return Status == EFI_SUCCESS;
1386 }
1387 return FALSE;
1388}
1389
1390EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry, IN UINTN FilterMode)
1391{

Callers 2

ResetNativeNvramFunction · 0.85
ScanToolFunction · 0.85

Calls 4

EfiLibFileInfoFunction · 0.50
FreePoolFunction · 0.50
OpenMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected