MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / renameFile

Function renameFile

src/sd_functions.cpp:115–131  ·  view source on GitHub ↗

** Function name: renameFile ** Description: rename file or folder ***************************************************************************************/

Source from the content-addressed store, hash-verified

113** Description: rename file or folder
114***************************************************************************************/
115bool renameFile(String path, String filename) {
116 String newName = keyboard(filename, 76, "Type the new Name:");
117 if (newName == "" || newName == String(KEY_ESCAPE) || newName == filename) { return false; }
118 if (!setupSdCard()) {
119 // Serial.println("Falha ao inicializar o cartão SD");
120 return false;
121 }
122
123 // Rename the file of folder
124 if (SDM.rename(path, path.substring(0, path.lastIndexOf('/')) + "/" + newName)) {
125 // Serial.println("Renamed from " + filename + " to " + newName);
126 return true;
127 } else {
128 // Serial.println("Fail on rename.");
129 return false;
130 }
131}
132
133/***************************************************************************************
134** Function name: copyFile

Callers 1

loopSDFunction · 0.70

Calls 1

keyboardFunction · 0.70

Tested by

no test coverage detected