Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
89b1c4a6
Commit
89b1c4a6
authored
May 02, 2018
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/vfs: Delegate import_stat to vfs.stat to allow generic FS import.
parent
60db8092
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
extmod/vfs.c
extmod/vfs.c
+20
-2
No files found.
extmod/vfs.c
View file @
89b1c4a6
...
...
@@ -130,8 +130,26 @@ mp_import_stat_t mp_vfs_import_stat(const char *path) {
return
fat_vfs_import_stat
(
MP_OBJ_TO_PTR
(
vfs
->
obj
),
path_out
);
}
#endif
// TODO delegate to vfs.stat() method
// delegate to vfs.stat() method
mp_obj_t
path_o
=
mp_obj_new_str
(
path_out
,
strlen
(
path_out
));
mp_obj_t
stat
;
nlr_buf_t
nlr
;
if
(
nlr_push
(
&
nlr
)
==
0
)
{
stat
=
mp_vfs_proxy_call
(
vfs
,
MP_QSTR_stat
,
1
,
&
path_o
);
nlr_pop
();
}
else
{
// assume an exception means that the path is not found
return
MP_IMPORT_STAT_NO_EXIST
;
}
mp_obj_t
*
items
;
mp_obj_get_array_fixed_n
(
stat
,
10
,
&
items
);
mp_int_t
st_mode
=
mp_obj_get_int
(
items
[
0
]);
if
(
st_mode
&
MP_S_IFDIR
)
{
return
MP_IMPORT_STAT_DIR
;
}
else
{
return
MP_IMPORT_STAT_FILE
;
}
}
mp_obj_t
mp_vfs_mount
(
size_t
n_args
,
const
mp_obj_t
*
pos_args
,
mp_map_t
*
kw_args
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment