@@ -151,7 +151,7 @@ ret_t path_app_root(char path[MAX_PATH + 1]) {
151
151
memset (exe_path , 0x00 , sizeof (exe_path ));
152
152
153
153
if (fs_get_exe (os_fs (), exe_path ) == RET_OK ) {
154
- path_normalize (exe_path , path , MAX_PATH + 1 );
154
+ return_value_if_fail ( path_normalize (exe_path , path , MAX_PATH + 1 ) == RET_OK , RET_FAIL );
155
155
p = strrchr (path , TK_PATH_SEP );
156
156
if (p != NULL ) {
157
157
* p = '\0' ;
@@ -308,8 +308,8 @@ ret_t path_replace_basename(char* result, int32_t size, const char* filename,
308
308
char dirname [MAX_PATH + 1 ];
309
309
return_value_if_fail (result != NULL && filename != NULL && basename != NULL , RET_BAD_PARAMS );
310
310
311
- path_normalize (filename , result , size );
312
- path_dirname (result , dirname , MAX_PATH );
311
+ return_value_if_fail ( path_normalize (filename , result , size ) == RET_OK , RET_FAIL );
312
+ return_value_if_fail ( path_dirname (result , dirname , MAX_PATH ) == RET_OK , RET_FAIL );
313
313
314
314
dirname [MAX_PATH ] = '\0' ;
315
315
return path_build (result , size , dirname , basename , NULL );
@@ -320,7 +320,7 @@ ret_t path_replace_extname(char* result, int32_t size, const char* filename, con
320
320
return_value_if_fail (result != NULL && filename != NULL && extname != NULL , RET_BAD_PARAMS );
321
321
322
322
memset (result , 0x00 , size );
323
- path_normalize (filename , result , size );
323
+ return_value_if_fail ( path_normalize (filename , result , size ) == RET_OK , RET_FAIL );
324
324
p = strrchr (result , '.' );
325
325
if (p != NULL ) {
326
326
uint32_t n = 0 ;
@@ -354,17 +354,15 @@ ret_t path_app_root_ex(char path[MAX_PATH + 1], const char* subpath) {
354
354
char app_root [MAX_PATH + 1 ] = {0 };
355
355
return_value_if_fail (path_app_root (app_root ) == RET_OK , RET_BAD_PARAMS );
356
356
357
- path_build (path , MAX_PATH , app_root , subpath , NULL );
358
-
359
- return RET_OK ;
357
+ return path_build (path , MAX_PATH , app_root , subpath , NULL );
360
358
}
361
359
362
360
const char * path_prepend_app_root (char full_path [MAX_PATH + 1 ], const char * path ) {
363
361
char app_root [MAX_PATH + 1 ] = {0 };
364
362
return_value_if_fail (path != NULL , NULL );
365
363
return_value_if_fail (path_app_root (app_root ) == RET_OK , NULL );
366
364
367
- path_build (full_path , MAX_PATH , app_root , path , NULL );
365
+ return_value_if_fail ( path_build (full_path , MAX_PATH , app_root , path , NULL ) == RET_OK , NULL );
368
366
369
367
return full_path ;
370
368
}
@@ -374,7 +372,7 @@ const char* path_prepend_temp_path(char full_path[MAX_PATH + 1], const char* pat
374
372
return_value_if_fail (path != NULL , NULL );
375
373
return_value_if_fail (fs_get_temp_path (os_fs (), temp_path ) == RET_OK , NULL );
376
374
377
- path_build (full_path , MAX_PATH , temp_path , path , NULL );
375
+ return_value_if_fail ( path_build (full_path , MAX_PATH , temp_path , path , NULL ) == RET_OK , NULL );
378
376
379
377
return full_path ;
380
378
}
@@ -384,7 +382,8 @@ const char* path_prepend_user_storage_path(char full_path[MAX_PATH + 1], const c
384
382
return_value_if_fail (path != NULL , NULL );
385
383
return_value_if_fail (fs_get_user_storage_path (os_fs (), user_storage_path ) == RET_OK , NULL );
386
384
387
- path_build (full_path , MAX_PATH , user_storage_path , path , NULL );
385
+ return_value_if_fail (path_build (full_path , MAX_PATH , user_storage_path , path , NULL ) == RET_OK ,
386
+ NULL );
388
387
389
388
return full_path ;
390
389
}
@@ -393,7 +392,7 @@ ret_t path_abs_normalize(const char* filename, char* result, int32_t size) {
393
392
char path [MAX_PATH + 1 ];
394
393
return_value_if_fail (filename != NULL && result != NULL && size > 0 , RET_BAD_PARAMS );
395
394
396
- path_abs (filename , path , MAX_PATH );
395
+ return_value_if_fail ( path_abs (filename , path , MAX_PATH ) == RET_OK , RET_FAIL );
397
396
return path_normalize (path , result , size );
398
397
}
399
398
@@ -403,10 +402,10 @@ const char* path_abs_normalize_with_root(const char* root, const char* rel_filen
403
402
char abs_root [MAX_PATH + 1 ];
404
403
return_value_if_fail (root != NULL && rel_filename != NULL , NULL );
405
404
406
- path_abs_normalize (root , abs_root , MAX_PATH );
405
+ return_value_if_fail ( path_abs_normalize (root , abs_root , MAX_PATH ) == RET_OK , NULL );
407
406
408
- path_build (path , MAX_PATH , abs_root , rel_filename , NULL );
409
- path_normalize (path , filename , MAX_PATH );
407
+ return_value_if_fail ( path_build (path , MAX_PATH , abs_root , rel_filename , NULL ) == RET_OK , NULL );
408
+ return_value_if_fail ( path_normalize (path , filename , MAX_PATH ) == RET_OK , NULL );
410
409
411
410
if (strncmp (filename , abs_root , strlen (abs_root )) == 0 ) {
412
411
return filename ;
0 commit comments