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

Method openFileWrite

Marlin/src/sd/cardreader.cpp:863–887  ·  view source on GitHub ↗

Open a file by DOS path for write

Source from the content-addressed store, hash-verified

861// Open a file by DOS path for write
862//
863void CardReader::openFileWrite(const char * const path) {
864 if (!isMounted()) return;
865
866 announceOpen(2, path);
867 TERN_(HAS_MEDIA_SUBCALLS, file_subcall_ctr = 0);
868
869 abortFilePrintNow();
870
871 MediaFile *diveDir;
872 const char * const fname = diveToFile(false, diveDir, path);
873 if (!fname) return openFailed(path);
874
875 #if DISABLED(SDCARD_READONLY)
876 if (myfile.open(diveDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
877 flag.saving = true;
878 selectFileByName(fname);
879 TERN_(EMERGENCY_PARSER, emergency_parser.disable());
880 echo_write_to_file(fname);
881 ui.set_status(fname);
882 return;
883 }
884 #endif
885
886 openFailed(fname);
887}
888
889/**
890 * Check if a file exists by absolute or workDir-relative path

Callers 5

DMethod · 0.80
M993Method · 0.80
M28Method · 0.80
wifi_gcode_execFunction · 0.80
file_openMethod · 0.80

Calls 7

announceOpenFunction · 0.85
openFailedFunction · 0.85
echo_write_to_fileFunction · 0.85
set_statusMethod · 0.80
DISABLEDFunction · 0.50
openMethod · 0.45
disableMethod · 0.45

Tested by

no test coverage detected