Compare commits
3 Commits
9e3676a1bb
...
853a1f4b26
Author | SHA1 | Date | |
---|---|---|---|
|
853a1f4b26 | ||
|
a3752b3f8c | ||
|
3f77399538 |
Binary file not shown.
@ -824,18 +824,33 @@ class FTPServer : public TCPServer<T>
|
|||||||
if (currentDirectory)
|
if (currentDirectory)
|
||||||
{
|
{
|
||||||
currentDirectory.rewindDirectory();
|
currentDirectory.rewindDirectory();
|
||||||
while (true) //Maybe be remove in the future to improve responsiveness
|
while (true) //May be removed in the future to improve responsiveness
|
||||||
{
|
{
|
||||||
File fileOrDir = currentDirectory.openNextFile();
|
File fileOrDir = currentDirectory.openNextFile();
|
||||||
|
|
||||||
if (!fileOrDir) //No more files in the directory
|
if (!fileOrDir) //No more files in the directory
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef DEBUG_FTPS
|
//We try to retrieve the last modification date
|
||||||
Serial.printf("Filename : %s\n", fileOrDir.name());
|
const time_t fileModifDate = fileOrDir.getLastWrite();
|
||||||
#endif
|
struct tm *timeP = localtime(&fileModifDate);
|
||||||
|
//Buffer necessary to store the month's three letter abbreviation
|
||||||
|
char month[4] = "";
|
||||||
|
|
||||||
client->_dataClient.printf("%crwxrwxrwx 1 owner esp8266 %d Aug 26 16:31 %s\r\n", fileOrDir.isDirectory() ? 'd' : '-', fileOrDir.isDirectory() ? 0 : fileOrDir.size(), fileOrDir.name());
|
#ifdef DEBUG_FTPS
|
||||||
|
Serial.printf("Filename : %s, %s %d %d %d:%d\n", fileOrDir.name(), monthNumTo3LetterAbbreviation(month, timeP->tm_mon), timeP->tm_mon, timeP->tm_mday, timeP->tm_hour, timeP->tm_min);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char zero_prepended[3][3] = {"","",""};
|
||||||
|
|
||||||
|
client->_dataClient.printf("%crwxrwxrwx 1 owner esp8266 %d %s %s %s:%s %s\r\n",
|
||||||
|
fileOrDir.isDirectory() ? 'd' : '-',
|
||||||
|
fileOrDir.isDirectory() ? 0 : fileOrDir.size(),
|
||||||
|
monthNumTo3LetterAbreviation(month, timeP->tm_mon),
|
||||||
|
dateTimeFormater(zero_prepended[0],timeP->tm_mday,'0'),
|
||||||
|
dateTimeFormater(zero_prepended[1],timeP->tm_hour,'0'),
|
||||||
|
dateTimeFormater(zero_prepended[2],timeP->tm_min,'0'),
|
||||||
|
fileOrDir.name());
|
||||||
|
|
||||||
fileOrDir.close();
|
fileOrDir.close();
|
||||||
}
|
}
|
||||||
@ -849,10 +864,8 @@ class FTPServer : public TCPServer<T>
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,3 +67,18 @@ char *lastIndexOf(char *str, const char character)
|
|||||||
|
|
||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *monthNumTo3LetterAbbreviation(char *buffer, const uint8_t monthNumber)
|
||||||
|
{
|
||||||
|
static const char monthArray[][4] = {{"Jan"},{"Feb"},{"Mar"},{"Apr"},{"May"},{"Jun"},{"Jul"},{"Aug"},{"Sep"},{"Oct"},{"Nov"},{"Dec"}};
|
||||||
|
|
||||||
|
if(buffer == NULL) return NULL;
|
||||||
|
|
||||||
|
if(monthNumber >= 1 && monthNumber <= 12)
|
||||||
|
strcpy_P(buffer, monthArray[monthNumber-1]);
|
||||||
|
else //Default is january
|
||||||
|
strcpy_P(buffer, monthArray[0]);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
@ -57,4 +57,6 @@ char *lastIndexOf(char *str, const char character);
|
|||||||
|
|
||||||
char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
|
char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
|
||||||
|
|
||||||
|
char *monthNumTo3LetterAbbreviation(char *month, const uint8_t monthNumber);
|
||||||
|
|
||||||
#endif //DEFINITION_H
|
#endif //DEFINITION_H
|
||||||
|
Loading…
Reference in New Issue
Block a user