@@ -86,7 +86,7 @@ static void make_sample_code_file(FATFS *fatfs) {
8686
8787// we don't make this function static because it needs a lot of stack and we
8888// want it to be executed without using stack within main() function
89- void filesystem_init (bool create_allowed , bool force_create ) {
89+ bool filesystem_init (bool create_allowed , bool force_create ) {
9090 // init the vfs object
9191 fs_user_mount_t * vfs_fat = & _internal_vfs ;
9292 vfs_fat -> blockdev .flags = 0 ;
@@ -102,11 +102,11 @@ void filesystem_init(bool create_allowed, bool force_create) {
102102 formats |= FM_EXFAT | FM_FAT32 ;
103103 #endif
104104 res = f_mkfs (& vfs_fat -> fatfs , formats , 0 , working_buf , sizeof (working_buf ));
105- // Flush the new file system to make sure it's repaired immediately.
106- supervisor_flash_flush ();
107105 if (res != FR_OK ) {
108- return ;
106+ return false ;
109107 }
108+ // Flush the new file system to make sure it's repaired immediately.
109+ supervisor_flash_flush ();
110110
111111 // set label
112112 #ifdef CIRCUITPY_DRIVE_LABEL
@@ -115,13 +115,13 @@ void filesystem_init(bool create_allowed, bool force_create) {
115115 res = f_setlabel (& vfs_fat -> fatfs , "CIRCUITPY" );
116116 #endif
117117 if (res != FR_OK ) {
118- return ;
118+ return false ;
119119 }
120120
121121 // inhibit file indexing on MacOS
122122 res = f_mkdir (& vfs_fat -> fatfs , "/.fseventsd" );
123123 if (res != FR_OK ) {
124- return ;
124+ return false ;
125125 }
126126 make_empty_file (& vfs_fat -> fatfs , "/.metadata_never_index" );
127127 make_empty_file (& vfs_fat -> fatfs , "/.Trashes" );
@@ -132,13 +132,13 @@ void filesystem_init(bool create_allowed, bool force_create) {
132132 // create empty lib directory
133133 res = f_mkdir (& vfs_fat -> fatfs , "/lib" );
134134 if (res != FR_OK ) {
135- return ;
135+ return false ;
136136 }
137137
138138 // and ensure everything is flushed
139139 supervisor_flash_flush ();
140140 } else if (res != FR_OK ) {
141- return ;
141+ return false ;
142142 }
143143 mp_vfs_mount_t * vfs = & _mp_vfs ;
144144 vfs -> str = "/" ;
@@ -150,6 +150,8 @@ void filesystem_init(bool create_allowed, bool force_create) {
150150 // The current directory is used as the boot up directory.
151151 // It is set to the internal flash filesystem by default.
152152 MP_STATE_PORT (vfs_cur ) = vfs ;
153+
154+ return true;
153155}
154156
155157void filesystem_flush (void ) {
0 commit comments