Followup to SD menu optimization (#15252)
This commit is contained in:
		
				
					committed by
					
						
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							61e3f119f4
						
					
				
				
					commit
					15bea5043c
				
			@@ -273,7 +273,7 @@ int16_t SdBaseFile::fgets(char* str, int16_t num, char* delim) {
 | 
			
		||||
 *
 | 
			
		||||
 * \return true for success, false for failure.
 | 
			
		||||
 */
 | 
			
		||||
bool SdBaseFile::getFilename(char * const name) {
 | 
			
		||||
bool SdBaseFile::getDosName(char * const name) {
 | 
			
		||||
  if (!isOpen()) return false;
 | 
			
		||||
 | 
			
		||||
  if (isRoot()) {
 | 
			
		||||
@@ -957,7 +957,7 @@ void SdBaseFile::printFatTime(uint16_t fatTime) {
 | 
			
		||||
 */
 | 
			
		||||
bool SdBaseFile::printName() {
 | 
			
		||||
  char name[FILENAME_LENGTH];
 | 
			
		||||
  if (!getFilename(name)) return false;
 | 
			
		||||
  if (!getDosName(name)) return false;
 | 
			
		||||
  SERIAL_ECHO(name);
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -286,7 +286,7 @@ class SdBaseFile {
 | 
			
		||||
   */
 | 
			
		||||
  bool isRoot() const { return type_ == FAT_FILE_TYPE_ROOT_FIXED || type_ == FAT_FILE_TYPE_ROOT32; }
 | 
			
		||||
 | 
			
		||||
  bool getFilename(char * const name);
 | 
			
		||||
  bool getDosName(char * const name);
 | 
			
		||||
  void ls(uint8_t flags = 0, uint8_t indent = 0);
 | 
			
		||||
 | 
			
		||||
  bool mkdir(SdBaseFile* dir, const char* path, bool pFlag = true);
 | 
			
		||||
 
 | 
			
		||||
@@ -313,7 +313,7 @@ void CardReader::ls() {
 | 
			
		||||
void CardReader::printFilename() {
 | 
			
		||||
  if (file.isOpen()) {
 | 
			
		||||
    char dosFilename[FILENAME_LENGTH];
 | 
			
		||||
    file.getFilename(dosFilename);
 | 
			
		||||
    file.getDosName(dosFilename);
 | 
			
		||||
    SERIAL_ECHO(dosFilename);
 | 
			
		||||
    #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
 | 
			
		||||
      getfilename(0, dosFilename);
 | 
			
		||||
@@ -404,7 +404,7 @@ void CardReader::openLogFile(char * const path) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void appendAtom(SdFile &file, char *& dst, uint8_t &cnt) {
 | 
			
		||||
  file.getFilename(dst);
 | 
			
		||||
  file.getDosName(dst);
 | 
			
		||||
  while (*dst && cnt < MAXPATHNAMELENGTH) { dst++; cnt++; }
 | 
			
		||||
  if (cnt < MAXPATHNAMELENGTH) { *dst = '/'; dst++; cnt++; }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,7 @@ public:
 | 
			
		||||
  static inline void setIndex(const uint32_t index) { sdpos = index; file.seekSet(index); }
 | 
			
		||||
  static inline uint32_t getIndex() { return sdpos; }
 | 
			
		||||
  static inline uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; }
 | 
			
		||||
  static inline char* getWorkDirName() { workDir.getFilename(filename); return filename; }
 | 
			
		||||
  static inline char* getWorkDirName() { workDir.getDosName(filename); return filename; }
 | 
			
		||||
  static inline int16_t read(void* buf, uint16_t nbyte) { return file.isOpen() ? file.read(buf, nbyte) : -1; }
 | 
			
		||||
  static inline int16_t write(void* buf, uint16_t nbyte) { return file.isOpen() ? file.write(buf, nbyte) : -1; }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user