minor changes
This commit is contained in:
parent
ce4ef44dcd
commit
571a1c5c39
|
|
@ -467,6 +467,9 @@ String DirectoryNode::getCurrentPlayingFilePath() const
|
|||
if (currentPlaying != nullptr)
|
||||
{
|
||||
String filePath = name;
|
||||
if (!filePath.startsWith("/")) {
|
||||
filePath = "/"+filePath;
|
||||
}
|
||||
if (!filePath.endsWith("/"))
|
||||
{
|
||||
filePath += "/";
|
||||
|
|
|
|||
10
src/main.cpp
10
src/main.cpp
|
|
@ -222,7 +222,7 @@ void handleUpload(AsyncWebServerRequest *request, String filename, size_t index,
|
|||
}
|
||||
|
||||
// Flush data periodically to ensure it's written
|
||||
if (index % 4096 == 0) { // Flush every 4KB
|
||||
if (index % 2048 == 0) { // Flush every 2KB
|
||||
request->_tempFile.flush();
|
||||
}
|
||||
|
||||
|
|
@ -262,8 +262,10 @@ void handleMoveFile(AsyncWebServerRequest *request) {
|
|||
String to = request->arg("to");
|
||||
|
||||
if (SD.exists(from)) {
|
||||
SD.rename(from.c_str(), to.c_str());
|
||||
SD.rename(from, to);
|
||||
Serial.println("Moved file: " + from + " to " + to);
|
||||
// Rebuild directory tree to update file list
|
||||
rootNode.buildDirectoryTree("/");
|
||||
request->send(200, "text/plain", "File moved successfully.");
|
||||
} else {
|
||||
Serial.println("File not found: " + from);
|
||||
|
|
@ -275,8 +277,10 @@ void handleDeleteFile(AsyncWebServerRequest *request) {
|
|||
String filename = request->arg("filename");
|
||||
|
||||
if (SD.exists(filename)) {
|
||||
SD.remove(filename);
|
||||
SD.remove(filename.c_str());
|
||||
Serial.println("Deleted file: " + filename);
|
||||
// Rebuild directory tree to update file list
|
||||
rootNode.buildDirectoryTree("/");
|
||||
request->send(200, "text/plain", "File deleted successfully.");
|
||||
} else {
|
||||
Serial.println("File not found: " + filename);
|
||||
|
|
|
|||
Loading…
Reference in New Issue