luat_fs_win32.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "luat_base.h"
  2. #include "luat_fs.h"
  3. #include "luat_mem.h"
  4. #include "luat_luadb.h"
  5. #ifdef LUAT_USE_LVGL
  6. #include "lvgl.h"
  7. void luat_lv_fs_init(void);
  8. void lv_bmp_init(void);
  9. void lv_png_init(void);
  10. void lv_split_jpeg_init(void);
  11. #endif
  12. extern const struct luat_vfs_filesystem vfs_fs_posix;
  13. // extern const struct luat_vfs_filesystem vfs_fs_onefile;
  14. extern const struct luat_vfs_filesystem vfs_fs_luadb;
  15. extern const char* luat_luadb_mock;
  16. // #ifdef LUAT_USE_VFS_INLINE_LIB
  17. // extern const luadb_file_t *luat_inline2_libs_64bit;
  18. // #endif
  19. typedef struct luat_fs_onefile
  20. {
  21. char* ptr;
  22. uint32_t size;
  23. uint32_t offset;
  24. }luat_fs_onefile_t;
  25. int luat_fs_init(void) {
  26. #ifdef LUAT_USE_FS_VFS
  27. // vfs进行必要的初始化
  28. luat_vfs_init(NULL);
  29. // 注册vfs for posix 实现
  30. luat_vfs_reg(&vfs_fs_posix);
  31. luat_vfs_reg(&vfs_fs_luadb);
  32. luat_fs_conf_t conf = {
  33. .busname = "",
  34. .type = "posix",
  35. .filesystem = "posix",
  36. .mount_point = "", // window环境下, 需要支持任意路径的读取,不能强制要求必须是/
  37. };
  38. luat_fs_mount(&conf);
  39. luat_fs_conf_t conf2 = {
  40. .busname = (char*)luat_luadb_mock,
  41. .type = "luadb",
  42. .filesystem = "luadb",
  43. .mount_point = "/luadb/",
  44. };
  45. luat_fs_mount(&conf2);
  46. #endif
  47. #ifdef LUAT_USE_LVGL
  48. luat_lv_fs_init();
  49. lv_bmp_init();
  50. lv_png_init();
  51. lv_split_jpeg_init();
  52. #endif
  53. return 0;
  54. }