@@ -201,11 +201,11 @@ impl File {
201
201
let status = unsafe { vex_sdk:: vexFileStatus ( path. as_ptr ( ) ) } ;
202
202
203
203
if opts. create_new && status != 0 {
204
- return Err ( io:: const_error!( io:: ErrorKind :: AlreadyExists , "File exists" , ) ) ;
204
+ return Err ( io:: const_error!( io:: ErrorKind :: AlreadyExists , "file exists" , ) ) ;
205
205
} else if !opts. create && status == 0 {
206
206
return Err ( io:: const_error!(
207
207
io:: ErrorKind :: NotFound ,
208
- "No such file or directory" ,
208
+ "no such file or directory" ,
209
209
) ) ;
210
210
}
211
211
}
@@ -215,7 +215,7 @@ impl File {
215
215
OpenOptions { read : true , write : true , .. } => {
216
216
return Err ( io:: const_error!(
217
217
io:: ErrorKind :: InvalidInput ,
218
- "Opening files with read and write access is unsupported on this target" ,
218
+ "opening files with read and write access is unsupported on this target" ,
219
219
) ) ;
220
220
}
221
221
@@ -259,12 +259,12 @@ impl File {
259
259
} ,
260
260
261
261
_ => {
262
- return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Invalid argument" ) ) ;
262
+ return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "invalid argument" ) ) ;
263
263
}
264
264
} ;
265
265
266
266
if file. is_null ( ) {
267
- Err ( io:: const_error!( io:: ErrorKind :: NotFound , "Could not open file" ) )
267
+ Err ( io:: const_error!( io:: ErrorKind :: NotFound , "could not open file" ) )
268
268
} else {
269
269
Ok ( Self { fd : FileDesc ( file) } )
270
270
}
@@ -279,7 +279,7 @@ impl File {
279
279
} ) {
280
280
Ok ( FileAttr :: File { size } )
281
281
} else {
282
- Err ( io:: const_error!( io:: ErrorKind :: InvalidData , "Failed to get file size" ) )
282
+ Err ( io:: const_error!( io:: ErrorKind :: InvalidData , "failed to get file size" ) )
283
283
}
284
284
}
285
285
@@ -324,7 +324,7 @@ impl File {
324
324
} ;
325
325
326
326
if read < 0 {
327
- Err ( io:: const_error!( io:: ErrorKind :: Other , "Could not read from file" ) )
327
+ Err ( io:: const_error!( io:: ErrorKind :: Other , "could not read from file" ) )
328
328
} else {
329
329
Ok ( read as usize )
330
330
}
@@ -352,7 +352,7 @@ impl File {
352
352
} ;
353
353
354
354
if written < 0 {
355
- Err ( io:: const_error!( io:: ErrorKind :: Other , "Could not write to file" ) )
355
+ Err ( io:: const_error!( io:: ErrorKind :: Other , "could not write to file" ) )
356
356
} else {
357
357
Ok ( written as usize )
358
358
}
@@ -380,7 +380,7 @@ impl File {
380
380
let position = unsafe { vex_sdk:: vexFileTell ( self . fd . 0 ) } ;
381
381
382
382
position. try_into ( ) . map_err ( |_| {
383
- io:: const_error!( io:: ErrorKind :: InvalidData , "Failed to get current location in file" )
383
+ io:: const_error!( io:: ErrorKind :: InvalidData , "failed to get current location in file" )
384
384
} )
385
385
}
386
386
@@ -397,7 +397,7 @@ impl File {
397
397
offset. try_into ( ) . map_err ( |_| {
398
398
io:: const_error!(
399
399
io:: ErrorKind :: InvalidInput ,
400
- "Cannot seek to an offset too large to fit in a 32 bit integer" ,
400
+ "cannot seek to an offset too large to fit in a 32 bit integer" ,
401
401
)
402
402
} )
403
403
}
@@ -497,7 +497,8 @@ pub fn exists(path: &Path) -> io::Result<bool> {
497
497
}
498
498
499
499
pub fn stat ( p : & Path ) -> io:: Result < FileAttr > {
500
- // `vexFileStatus` returns 3 if the given path is a directory.
500
+ // `vexFileStatus` returns 3 if the given path is a directory, 1 if the path is a
501
+ // file, or 0 if no such path exists.
501
502
const FILE_STATUS_DIR : u32 = 3 ;
502
503
503
504
run_path_with_cstr ( p, & |c_path| {
0 commit comments