Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moduos fix file size os.stat() #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ports/gprs_a9/moduos.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ mp_obj_t moduos_internal_flash_stat(mp_obj_t path_in) {
// ========================================
const char* path = mp_obj_str_get_str(path_in);
// check if folder
int32_t size = 0;
int64_t size = 0;
Dir_t* folder = NULL;
mp_int_t mode = 0;
int32_t fd = NULL;
Expand All @@ -347,8 +347,8 @@ mp_obj_t moduos_internal_flash_stat(mp_obj_t path_in) {
mode = MP_S_IFDIR;

} else if ((fd = API_FS_Open(path, FS_O_RDONLY, 0)) >= 0) {
API_FS_Close(fd);
size = API_FS_GetFileSize(fd);
API_FS_Close(fd);
mode = MP_S_IFREG;

} else
Expand All @@ -361,7 +361,7 @@ mp_obj_t moduos_internal_flash_stat(mp_obj_t path_in) {
MP_OBJ_NEW_SMALL_INT(0),
MP_OBJ_NEW_SMALL_INT(0),
MP_OBJ_NEW_SMALL_INT(0),
mp_obj_new_int(size),
mp_obj_new_int_from_uint(size),
MP_OBJ_NEW_SMALL_INT(0x2821),
MP_OBJ_NEW_SMALL_INT(0x2821),
MP_OBJ_NEW_SMALL_INT(0x2821),
Expand Down