force hide files on sdc

This commit is contained in:
gemu2015 2021-10-19 08:08:55 +02:00
parent 5c79d2dc87
commit 7a01c70e7c
1 changed files with 29 additions and 2 deletions

View File

@ -146,6 +146,7 @@ void UfsCheckSDCardInit(void) {
cs = Pin(GPIO_SDCARD_CS);
}
#ifdef EPS8266
SPI.begin();
#endif // EPS8266
@ -563,7 +564,12 @@ const char UFS_FORM_FILE_UPGb[] PROGMEM =
"<form method='get' action='ufse'><input type='hidden' file='" D_NEW_FILE "'>"
"<button type='submit'>" D_CREATE_NEW_FILE "</button></form>"
#endif
"<input type='checkbox' id='shf' onclick='sf(eb(\"shf\").checked);' name='shf'>" D_SHOW_HIDDEN_FILES "</input>"
;
const char UFS_FORM_FILE_UPGb1[] PROGMEM =
"<input type='checkbox' id='shf' onclick='sf(eb(\"shf\").checked);' name='shf'>" D_SHOW_HIDDEN_FILES "</input>";
const char UFS_FORM_FILE_UPGb2[] PROGMEM =
"</fieldset>"
"</div>"
"<div id='f2' name='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED " ...</b></div>";
@ -665,14 +671,30 @@ void UfsDirectory(void) {
}
WSContentSend_P(UFS_FORM_SDC_DIRc);
WSContentSend_P(UFS_FORM_FILE_UPGb);
if (!isSDC()) {
WSContentSend_P(UFS_FORM_FILE_UPGb1);
}
WSContentSend_P(UFS_FORM_FILE_UPGb2);
WSContentSpaceButton(BUTTON_MANAGEMENT);
WSContentStop();
Web.upload_file_type = UPL_UFSFILE;
}
// return true if SDC
bool isSDC(void) {
#ifndef SDC_HIDE_INVISIBLES
return false;
#else
if (((uint32_t)ufsp != (uint32_t)ffsp) && ((uint32_t)ffsp == (uint32_t)dfsp)) return false;
if (((uint32_t)ufsp == (uint32_t)ffsp) && (ufs_type != UFS_TSDC)) return false;
return true;
#endif
}
void UfsListDir(char *path, uint8_t depth) {
char name[32];
char name[48];
char npath[128];
char format[12];
sprintf(format, PSTR("%%-%ds"), 24 - depth);
@ -717,6 +739,8 @@ void UfsListDir(char *path, uint8_t depth) {
// osx formatted disks contain a lot of stuff we dont want
bool hiddable = UfsReject((char*)ep);
if (!hiddable || !isSDC() ) {
for (uint8_t cnt = 0; cnt<depth; cnt++) {
*cp++ = '-';
}
@ -752,6 +776,9 @@ void UfsListDir(char *path, uint8_t depth) {
}
entry.close();
}
}
dir.close();
}
}