feat(fsdrv) fix issues for win32 backends (#3284)

This commit is contained in:
Kenji Mouri
2022-04-26 22:55:40 +08:00
committed by GitHub
parent 4094a37a5f
commit 3c0a3d05cc
2 changed files with 9 additions and 9 deletions

View File

@@ -219,14 +219,14 @@ static void * fs_dir_open(lv_fs_drv_t * drv, const char * path)
return handle; return handle;
#else #else
handle->dir_p = INVALID_HANDLE_VALUE; handle->dir_p = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA fdata; WIN32_FIND_DATAA fdata;
/*Make the path relative to the current directory (the projects root folder)*/ /*Make the path relative to the current directory (the projects root folder)*/
char buf[MAX_PATH_LEN]; char buf[MAX_PATH_LEN];
lv_snprintf(buf, sizeof(buf), LV_FS_STDIO_PATH "%s\\*", path); lv_snprintf(buf, sizeof(buf), LV_FS_STDIO_PATH "%s\\*", path);
strcpy(handle->next_fn, ""); strcpy(handle->next_fn, "");
handle->dir_p = FindFirstFile(buf, &fdata); handle->dir_p = FindFirstFileA(buf, &fdata);
do { do {
if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) { if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) {
continue; continue;
@@ -278,9 +278,9 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
strcpy(fn, handle->next_fn); strcpy(fn, handle->next_fn);
strcpy(handle->next_fn, ""); strcpy(handle->next_fn, "");
WIN32_FIND_DATA fdata; WIN32_FIND_DATAA fdata;
if(FindNextFile(handle->dir_p, &fdata) == false) return LV_FS_RES_OK; if(FindNextFileA(handle->dir_p, &fdata) == false) return LV_FS_RES_OK;
do { do {
if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) { if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) {
continue; continue;
@@ -294,7 +294,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
} }
break; break;
} }
} while(FindNextFile(handle->dir_p, &fdata)); } while(FindNextFileA(handle->dir_p, &fdata));
#endif #endif
return LV_FS_RES_OK; return LV_FS_RES_OK;

View File

@@ -1,4 +1,4 @@
/** /**
* @file lv_fs_win32.c * @file lv_fs_win32.c
* *
*/ */
@@ -362,7 +362,7 @@ static void * fs_dir_open(lv_fs_drv_t * drv, const char * path)
dir_handle_t * handle = (dir_handle_t *)lv_mem_alloc(sizeof(dir_handle_t)); dir_handle_t * handle = (dir_handle_t *)lv_mem_alloc(sizeof(dir_handle_t));
handle->dir_p = INVALID_HANDLE_VALUE; handle->dir_p = INVALID_HANDLE_VALUE;
handle->next_error = LV_FS_RES_OK; handle->next_error = LV_FS_RES_OK;
WIN32_FIND_DATA fdata; WIN32_FIND_DATAA fdata;
/*Make the path relative to the current directory (the projects root folder)*/ /*Make the path relative to the current directory (the projects root folder)*/
char buf[MAX_PATH_LEN]; char buf[MAX_PATH_LEN];
@@ -373,7 +373,7 @@ static void * fs_dir_open(lv_fs_drv_t * drv, const char * path)
#endif #endif
strcpy(handle->next_fn, ""); strcpy(handle->next_fn, "");
handle->dir_p = FindFirstFile(buf, &fdata); handle->dir_p = FindFirstFileA(buf, &fdata);
do { do {
if(is_dots_name(fdata.cFileName)) { if(is_dots_name(fdata.cFileName)) {
continue; continue;
@@ -416,7 +416,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
lv_fs_res_t current_error = handle->next_error; lv_fs_res_t current_error = handle->next_error;
strcpy(handle->next_fn, ""); strcpy(handle->next_fn, "");
WIN32_FIND_DATA fdata; WIN32_FIND_DATAA fdata;
while(FindNextFileA(handle->dir_p, &fdata)) { while(FindNextFileA(handle->dir_p, &fdata)) {
if(is_dots_name(fdata.cFileName)) { if(is_dots_name(fdata.cFileName)) {