瀏覽代碼

Fetch longname when a file exists

Scott Lahteine 3 年之前
父節點
當前提交
660420050b
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. 6
    0
      Marlin/src/sd/cardreader.cpp

+ 6
- 0
Marlin/src/sd/cardreader.cpp 查看文件

@@ -628,11 +628,17 @@ void CardReader::openFileWrite(char * const path) {
628 628
 
629 629
 //
630 630
 // Check if a file exists by absolute or workDir-relative path
631
+// If the file exists, the long name can also be fetched.
631 632
 //
632 633
 bool CardReader::fileExists(const char * const path) {
633 634
   if (!isMounted()) return false;
634 635
   SdFile *diveDir = nullptr;
635 636
   const char * const fname = diveToFile(false, diveDir, path);
637
+  if (fname) {
638
+    diveDir->rewind();
639
+    selectByName(*diveDir, fname);
640
+    diveDir->close();
641
+  }
636 642
   return fname != nullptr;
637 643
 }
638 644
 

Loading…
取消
儲存