Delete a file by name in the working directory
| 916 | // Delete a file by name in the working directory |
| 917 | // |
| 918 | void 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 | |
| 940 | void CardReader::report_status(TERN_(QUIETER_AUTO_REPORT_SD_STATUS, const bool isauto/*=false*/)) { |
| 941 | const bool has_job = isStillPrinting() || isPaused(); |
no test coverage detected