Cleanup: rename to BLI_path_cwd to BLI_path_abs_from_cwd

This is now more clearly a function that makes the path absolute
using the current working directory.
This commit is contained in:
Campbell Barton 2020-04-08 16:35:13 +10:00
parent 57468ae37e
commit a3c1605581
Notes: blender-bot 2023-02-14 00:30:26 +01:00
Referenced by issue #75592, curves displayed incorrectly
Referenced by issue #75536, particle_battle_crash
Referenced by issue #70765, Input Mouse or Tablet events are too sparse when input device moves very fast in Windows
5 changed files with 11 additions and 10 deletions

View File

@ -687,7 +687,7 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
BLI_strncpy(fullname, name, maxlen);
if (name[0] == '.') {
BLI_path_cwd(fullname, maxlen);
BLI_path_abs_from_cwd(fullname, maxlen);
#ifdef _WIN32
BLI_path_program_extensions_add_win32(fullname, maxlen);
#endif

View File

@ -100,7 +100,7 @@ bool BLI_path_frame_range(char *path, int sta, int end, int digits) ATTR_NONNULL
bool BLI_path_frame_get(char *path, int *r_frame, int *numdigits) ATTR_NONNULL();
void BLI_path_frame_strip(char *path, char *ext) ATTR_NONNULL();
bool BLI_path_frame_check_chars(const char *path) ATTR_NONNULL();
bool BLI_path_cwd(char *path, const size_t maxlen) ATTR_NONNULL();
bool BLI_path_abs_from_cwd(char *path, const size_t maxlen) ATTR_NONNULL();
void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL();
bool BLI_path_is_rel(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;

View File

@ -1116,13 +1116,14 @@ bool BLI_path_abs(char *path, const char *basepath)
}
/**
* Expands path relative to the current working directory, if it was relative.
* Returns true if such expansion was done.
* Checks for relative path, expanding them relative to the current working directory.
* Returns true if the expansion was performed.
*
* \note Should only be done with command line paths.
* this is _not_ something blenders internal paths support like the "//" prefix
* \note Should only be called with command line paths.
* This is _not_ something Blender's internal paths support, instead they use the "//" prefix.
* In most cases #BLI_path_abs should be used instead.
*/
bool BLI_path_cwd(char *path, const size_t maxlen)
bool BLI_path_abs_from_cwd(char *path, const size_t maxlen)
{
#ifdef DEBUG_STRSIZE
memset(path, 0xff, sizeof(*path) * maxlen);

View File

@ -940,7 +940,7 @@ static void bpy_module_delay_init(PyObject *bpy_proxy)
char filename_abs[1024];
BLI_strncpy(filename_abs, filename_rel, sizeof(filename_abs));
BLI_path_cwd(filename_abs, sizeof(filename_abs));
BLI_path_abs_from_cwd(filename_abs, sizeof(filename_abs));
Py_DECREF(filename_obj);
argv[0] = filename_abs;

View File

@ -1780,7 +1780,7 @@ static int arg_handle_python_file_run(int argc, const char **argv, void *data)
/* Make the path absolute because its needed for relative linked blends to be found */
char filename[FILE_MAX];
BLI_strncpy(filename, argv[1], sizeof(filename));
BLI_path_cwd(filename, sizeof(filename));
BLI_path_abs_from_cwd(filename, sizeof(filename));
bool ok;
BPY_CTX_SETUP(ok = BPY_execute_filepath(C, filename, NULL));
@ -1982,7 +1982,7 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data)
}
BLI_strncpy(filename, argv[0], sizeof(filename));
BLI_path_cwd(filename, sizeof(filename));
BLI_path_abs_from_cwd(filename, sizeof(filename));
/* load the file */
BKE_reports_init(&reports, RPT_PRINT);