fix(fs_posix): allow creating new file and set permission.
@@ -105,15 +105,15 @@ static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
LV_UNUSED(drv);
uint32_t flags = 0;
- if(mode == LV_FS_MODE_WR) flags = O_WRONLY;
+ if(mode == LV_FS_MODE_WR) flags = O_WRONLY | O_CREAT;
else if(mode == LV_FS_MODE_RD) flags = O_RDONLY;
- else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) flags = O_RDWR;
+ else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) flags = O_RDWR | O_CREAT;
/*Make the path relative to the current directory (the projects root folder)*/
char buf[256];
lv_snprintf(buf, sizeof(buf), LV_FS_POSIX_PATH "%s", path);
- int f = open(buf, flags);
+ int f = open(buf, flags, 0666);
if(f < 0) return NULL;
return (void *)(lv_uintptr_t)f;
