Browse Source

Support for more special characters allowed in file names (^ + = [ ] ;
,)

DRracer 4 years ago
parent
commit
11ce786aaa
2 changed files with 13 additions and 6 deletions
  1. 9 5
      Firmware/Marlin_main.cpp
  2. 4 1
      Firmware/SdBaseFile.cpp

+ 9 - 5
Firmware/Marlin_main.cpp

@@ -3815,10 +3815,14 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
 		//  lcd_calibration();
 	  // }
 
-  }  
-  else if (code_seen('^')) {
-    // nothing, this is a version line
-  } else if(code_seen('G'))
+  } 
+  // This prevents reading files with "^" in their names.
+  // Since it is unclear, if there is some usage of this construct,
+  // it will be deprecated in 3.9 alpha a possibly completely removed in the future:
+  // else if (code_seen('^')) {
+  //  // nothing, this is a version line
+  // }
+  else if(code_seen('G'))
   {
 	gcode_in_progress = (int)code_value();
 //	printf_P(_N("BEGIN G-CODE=%u\n"), gcode_in_progress);
@@ -5319,7 +5323,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
     // -----------------------------------
     case 23: 
       starpos = (strchr(strchr_pointer + 4,'*'));
-      if(starpos!=NULL)
+	  if(starpos!=NULL)
         *(starpos)='\0';
       card.openFile(strchr_pointer + 4,true);
       break;

+ 4 - 1
Firmware/SdBaseFile.cpp

@@ -394,7 +394,10 @@ bool SdBaseFile::make83Name(const char* str, uint8_t* name, const char** ptr) {
       i = 8;   // place for extension
     } else {
       // illegal FAT characters
-      PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
+      //PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
+      // 2019-08-27 really?
+      // Microsoft defines, that only a subset of these characters is not allowed.
+      PGM_P p = PSTR("|<>?/*\"\\");
       uint8_t b;
       while ((b = pgm_read_byte(p++))) if (b == c) goto fail;
       // check size and only allow ASCII printable characters