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-simulator
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-simulator
Commits
1ec3f5cf
Commit
1ec3f5cf
authored
Aug 16, 2019
by
George Wort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add exception checks for file system.
parent
94a20be5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
source/microbit/fileobj.c
source/microbit/fileobj.c
+1
-0
source/microbit/filesystem.c
source/microbit/filesystem.c
+1
-0
No files found.
source/microbit/fileobj.c
View file @
1ec3f5cf
...
...
@@ -137,6 +137,7 @@ static mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args) {
const
char
*
filename
=
mp_obj_str_get_data
(
args
[
0
],
&
name_len
);
RETURN_ON_EXCEPTION
(
MP_OBJ_NULL
)
file_descriptor_obj
*
res
=
microbit_file_open
(
filename
,
name_len
,
read
==
0
,
text
==
0
);
RETURN_ON_EXCEPTION
(
MP_OBJ_NULL
)
if
(
res
==
NULL
)
{
return
mp_raise_msg_o
(
&
mp_type_OSError
,
"file not found"
);
}
...
...
source/microbit/filesystem.c
View file @
1ec3f5cf
...
...
@@ -463,6 +463,7 @@ mp_lexer_t *microbit_file_lexer(qstr src_name, file_descriptor_obj *fd) {
mp_lexer_t
*
mp_lexer_new_from_file
(
const
char
*
filename
)
{
file_descriptor_obj
*
fd
=
microbit_file_open
(
filename
,
strlen
(
filename
),
false
,
false
);
RETURN_ON_EXCEPTION
(
NULL
)
if
(
fd
==
NULL
)
return
NULL
;
qstr
string
=
qstr_from_str
(
filename
);
...
...
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