MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / removeFile

Method removeFile

Marlin/src/sd/cardreader.cpp:918–938  ·  view source on GitHub ↗

Delete a file by name in the working directory

Source from the content-addressed store, hash-verified

916// Delete a file by name in the working directory
917//
918void CardReader::removeFile(const char * const name) {
919 if (!isMounted()) return;
920
921 //abortFilePrintNow();
922
923 MediaFile *itsDirPtr;
924 const char * const fname = diveToFile(false, itsDirPtr, name);
925 if (!fname) return;
926
927 #if ENABLED(SDCARD_READONLY)
928 SERIAL_ECHOLNPGM("Deletion failed (read-only), File: ", fname, ".");
929 #else
930 if (myfile.remove(itsDirPtr, fname)) {
931 SERIAL_ECHOLNPGM("File deleted:", fname);
932 sdpos = 0;
933 TERN_(SDCARD_SORT_ALPHA, presort());
934 }
935 else
936 SERIAL_ECHOLNPGM("Deletion failed, File: ", fname, ".");
937 #endif
938}
939
940void CardReader::report_status(TERN_(QUIETER_AUTO_REPORT_SD_STATUS, const bool isauto/*=false*/)) {
941 const bool has_job = isStillPrinting() || isPaused();

Callers 4

M30Method · 0.80
stopEspTransferFunction · 0.80
mks_wifi_firmware_updateFunction · 0.80
transfer_abortMethod · 0.80

Calls 1

removeMethod · 0.80

Tested by

no test coverage detected