Page MenuHome

Day of Clean Code: Split wrappers for C API functions into own files
Confirmed, NormalPublicDESIGN

Description

Currently we have wrappers for various OS functions shared between storage.c & path_util.c.

This proposal is to move this into a module BLI_os_* (note this is similar to Python's PyOS_ API functions).

These would include:

replace_os = (
    ("BLI_getenv",                "BLI_os_getenv"),
    ("BLI_setenv",                "BLI_os_setenv"),
    ("BLI_setenv_if_new",         "BLI_os_setenv_if_new"),
    ("BLI_current_working_dir",   "BLI_os_getcwd"),
)

Note, that there are other functions which wrap file access,
I'd like to handle this as a separate step, unless there is strong agreement to have BLI_os_fstat, BLI_os_ftell... etc.

We could handle renaming these at the same time as using common prefix for API functions:

  • BLI_dir_free_space
  • BLI_is_file
  • BLI_is_dir
  • BLI_exists