mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-14 01:15:38 -04:00
Display error message when trying to delete non-empty directory (#1321)
* Non-empty directory check * Non-empty directory check * Display error when attempting to delete non-empty directory * Clang Delete white-space that the friggin editor added * is_empty_directory * is_empty_directory * is_empty_directory * Now need to check if it's a directory first
This commit is contained in:
parent
411f6c0a34
commit
91c6e3fc30
3 changed files with 17 additions and 0 deletions
|
@ -568,6 +568,17 @@ bool is_directory(const path& file_path) {
|
|||
return fr == FR_OK && is_directory(static_cast<file_status>(filinfo.fattrib));
|
||||
}
|
||||
|
||||
bool is_empty_directory(const path& file_path) {
|
||||
DIR dir;
|
||||
FILINFO filinfo;
|
||||
|
||||
if (!is_directory(file_path))
|
||||
return false;
|
||||
|
||||
auto result = f_findfirst(&dir, &filinfo, reinterpret_cast<const TCHAR*>(file_path.c_str()), (const TCHAR*)u"*");
|
||||
return !((result == FR_OK) && (filinfo.fname[0] != (TCHAR)'\0'));
|
||||
}
|
||||
|
||||
space_info space(const path& p) {
|
||||
DWORD free_clusters{0};
|
||||
FATFS* fs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue