|
Blender
V2.93
|
Go to the source code of this file.
Macros | |
| #define | BLI_path_cmp strcmp |
| #define | BLI_path_ncmp strncmp |
| #define | FILE_MAXDIR 768 |
| #define | FILE_MAXFILE 256 |
| #define | FILE_MAX 1024 |
| #define | SEP '/' |
| #define | ALTSEP '\\' |
| #define | SEP_STR "/" |
| #define | ALTSEP_STR "\\" |
| #define | FILENAME_PARENT ".." |
| #define | FILENAME_CURRENT "." |
| #define | FILENAME_IS_PARENT(_n) (((_n)[0] == '.') && ((_n)[1] == '.') && ((_n)[2] == '\0')) |
| #define | FILENAME_IS_CURRENT(_n) (((_n)[0] == '.') && ((_n)[1] == '\0')) |
| #define | FILENAME_IS_CURRPAR(_n) (((_n)[0] == '.') && (((_n)[1] == '\0') || (((_n)[1] == '.') && ((_n)[2] == '\0')))) |
Functions | |
| void | BLI_setenv (const char *env, const char *val) ATTR_NONNULL(1) |
| void | BLI_setenv_if_new (const char *env, const char *val) ATTR_NONNULL(1) |
| const char * | BLI_getenv (const char *env) ATTR_NONNULL(1) |
| void | BLI_make_file_string (const char *relabase, char *string, const char *dir, const char *file) |
| bool | BLI_make_existing_file (const char *name) |
| void | BLI_split_dirfile (const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen) |
| void | BLI_split_dir_part (const char *string, char *dir, const size_t dirlen) |
| void | BLI_split_file_part (const char *string, char *file, const size_t filelen) |
| const char * | BLI_path_extension (const char *filepath) ATTR_NONNULL() |
| void | BLI_path_append (char *__restrict dst, const size_t maxlen, const char *__restrict file) ATTR_NONNULL() |
| void | BLI_join_dirfile (char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL() |
| size_t | BLI_path_join (char *__restrict dst, const size_t dst_len, const char *path_first,...) ATTR_NONNULL(1 |
| size_t | ATTR_SENTINEL (0) |
| const char * | BLI_path_basename (const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| bool | BLI_path_name_at_index (const char *__restrict path, const int index, int *__restrict r_offset, int *__restrict r_len) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| const char * | BLI_path_slash_rfind (const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| int | BLI_path_slash_ensure (char *string) ATTR_NONNULL() |
| void | BLI_path_slash_rstrip (char *string) ATTR_NONNULL() |
| const char * | BLI_path_slash_find (const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| void | BLI_path_slash_native (char *path) ATTR_NONNULL() |
| bool | BLI_path_program_search (char *fullname, const size_t maxlen, const char *name) |
| bool | BLI_path_extension_check (const char *str, const char *ext) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| bool | BLI_path_extension_check_n (const char *str,...) ATTR_NONNULL(1) ATTR_SENTINEL(0) |
| bool | BLI_path_extension_check_array (const char *str, const char **ext_array) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| bool | BLI_path_extension_check_glob (const char *str, const char *ext_fnmatch) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT |
| bool | BLI_path_extension_glob_validate (char *ext_fnmatch) ATTR_NONNULL() |
| bool | BLI_path_extension_replace (char *path, size_t maxlen, const char *ext) ATTR_NONNULL() |
| bool | BLI_path_extension_ensure (char *path, size_t maxlen, const char *ext) ATTR_NONNULL() |
| bool | BLI_path_filename_ensure (char *filepath, size_t maxlen, const char *filename) ATTR_NONNULL() |
| int | BLI_path_sequence_decode (const char *string, char *head, char *tail, unsigned short *r_num_len) |
| void | BLI_path_sequence_encode (char *string, const char *head, const char *tail, unsigned short numlen, int pic) |
| void | BLI_path_normalize (const char *relabase, char *path) ATTR_NONNULL(2) |
| void | BLI_path_normalize_dir (const char *relabase, char *dir) ATTR_NONNULL(2) |
| bool | BLI_filename_make_safe (char *fname) ATTR_NONNULL(1) |
| bool | BLI_path_make_safe (char *path) ATTR_NONNULL(1) |
| bool | BLI_path_parent_dir (char *path) ATTR_NONNULL() |
| bool | BLI_path_parent_dir_until_exists (char *path) ATTR_NONNULL() |
| bool | BLI_path_abs (char *path, const char *basepath) ATTR_NONNULL() |
| bool | BLI_path_frame (char *path, int frame, int digits) ATTR_NONNULL() |
| 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_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 |
| bool | BLI_path_is_unc (const char *path) |
| void | BLI_path_to_display_name (char *display_name, int maxlen, const char *name) ATTR_NONNULL() |
| bool | BLI_path_suffix (char *string, size_t maxlen, const char *suffix, const char *sep) ATTR_NONNULL() |
| #define ALTSEP '\\' |
Definition at line 145 of file BLI_path_util.h.
| #define ALTSEP_STR "\\" |
Definition at line 147 of file BLI_path_util.h.
| #define BLI_path_cmp strcmp |
Definition at line 126 of file BLI_path_util.h.
| #define BLI_path_ncmp strncmp |
Definition at line 127 of file BLI_path_util.h.
| #define FILE_MAX 1024 |
Definition at line 135 of file BLI_path_util.h.
| #define FILE_MAXDIR 768 |
Definition at line 133 of file BLI_path_util.h.
| #define FILE_MAXFILE 256 |
Definition at line 134 of file BLI_path_util.h.
| #define FILENAME_CURRENT "." |
Definition at line 152 of file BLI_path_util.h.
| #define FILENAME_IS_CURRENT | ( | _n | ) | (((_n)[0] == '.') && ((_n)[1] == '\0')) |
Definition at line 156 of file BLI_path_util.h.
| #define FILENAME_IS_CURRPAR | ( | _n | ) | (((_n)[0] == '.') && (((_n)[1] == '\0') || (((_n)[1] == '.') && ((_n)[2] == '\0')))) |
Definition at line 157 of file BLI_path_util.h.
| #define FILENAME_IS_PARENT | ( | _n | ) | (((_n)[0] == '.') && ((_n)[1] == '.') && ((_n)[2] == '\0')) |
Definition at line 155 of file BLI_path_util.h.
| #define FILENAME_PARENT ".." |
Definition at line 151 of file BLI_path_util.h.
| #define SEP '/' |
Definition at line 144 of file BLI_path_util.h.
| #define SEP_STR "/" |
Definition at line 146 of file BLI_path_util.h.
| size_t ATTR_SENTINEL | ( | 0 | ) |
| bool BLI_filename_make_safe | ( | char * | fname | ) |
Make given name safe to be used in paths.
For now, simply replaces reserved chars (as listed in https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words ) by underscores ('_').
Definition at line 299 of file path_util.c.
References BLI_str_tolower_ascii(), BLI_strdup(), len, MEM_freeN, and NULL.
Referenced by BLI_path_make_safe(), file_filename_enter_handle(), renamebutton_cb(), render_result_exr_file_path(), seq_disk_cache_get_dir(), and unpack_generate_paths().
| const char* BLI_getenv | ( | const char * | env | ) |
Get an env var, result has to be used immediately.
On windows #getenv gets its variables from a static copy of the environment variables taken at process start-up, causing it to not pick up on environment variables created during runtime. This function uses an alternative method to get environment variables that does pick up on runtime environment variables. The result will be UTF-8 encoded.
Definition at line 1313 of file path_util.c.
References alloc_utf16_from_8(), alloc_utf_8_from_16(), ARRAY_SIZE, buffer, free(), NULL, and result.
Referenced by BKE_appdir_folder_default(), BKE_appdir_folder_home(), BLI_current_working_dir(), BLI_path_program_search(), BLI_setenv_if_new(), BLT_lang_init(), colormanagement_init(), fsmenu_read_system(), get_thumb_dir(), test_env_path(), and where_is_temp().
| void BLI_join_dirfile | ( | char *__restrict | dst, |
| const size_t | maxlen, | ||
| const char *__restrict | dir, | ||
| const char *__restrict | file | ||
| ) |
Simple appending of filename to dir, does not check for valid path! Puts result into dst, which may be same area as dir.
Definition at line 1737 of file path_util.c.
References ALTSEP, BLI_assert, BLI_strncpy(), BLI_strnlen(), ELEM, file, and SEP.
Referenced by autocomplete_directory(), BKE_appdir_app_template_id_search(), BKE_appdir_program_python_search(), BKE_memfile_undo_encode(), BKE_modifier_path_init(), BKE_ptcache_disk_cache_rename(), BKE_ptcache_id_clear(), BKE_ptcache_remove(), blf_dir_search(), blf_load_font_default(), bli_builddir(), BLI_path_abs_from_cwd(), BLI_path_parent_dir(), blo_do_versions_250(), bookmark_add_exec(), bookmark_cleanup_exec(), bookmark_delete_exec(), bookmark_move_exec(), check_destination(), colormanagement_init(), blender::compositor::OutputFileNode::convertToOperations(), draw_seq_text_get_source(), dynamicPaint_bakeImageSequence(), ED_file_read_bookmarks(), ED_fsmenu_entry_set_name(), ED_fsmenu_entry_set_path(), file_delete_single(), file_draw_check_exists(), file_draw_list(), file_exec(), file_expand_directory(), file_filename_enter_handle(), file_sfile_to_operator_ex(), fileentry_uiname(), filelist_cache_previews_push(), filelist_geticon_ex(), filelist_readjob_do(), filelist_readjob_list_dir(), Freestyle_Init(), fsmenu_read_system(), get_proxy_filename(), get_tc_filename(), image_get_udim(), image_sequence_get_frame_ranges(), init_iconfile_list(), init_internal_icons(), is_filtered_lib(), join_dirfile_alloc(), make_temp_filepath(), missing_files_find__recursive(), new_folder_path(), open_exec(), outliner_id_copy_exec(), outliner_id_paste_exec(), pose_copy_exec(), pose_paste_exec(), renamebutton_cb(), render_result_exr_file_path(), reset_recent_exec(), rewrite_path_fixed_dirfile(), SEQ_add_image_init_alpha_mode(), SEQ_add_reload_new_file(), seq_open_anim_file(), seq_proxy_get_custom_file_fname(), seq_proxy_multiview_context_invalid(), seq_render_image_strip(), sequencer_add_movie_multiple_strips(), sequencer_add_sound_multiple_strips(), sequencer_change_path_invoke(), sig_handle_crash(), view3d_copybuffer_exec(), view3d_pastebuffer_exec(), wm_autosave_delete(), wm_autosave_location(), wm_block_splash_image(), WM_exit_ex(), wm_history_file_read(), wm_history_file_write(), WM_init(), wm_lib_relocate_exec_do(), wm_link_append_exec(), wm_platform_support_check_approval(), WM_recover_last_session(), workspace_config_file_read(), workspace_system_file_read(), and DocumentImporter::writeImage().
| bool BLI_make_existing_file | ( | const char * | name | ) |
Ensures that the parent directory of name exists.
Definition at line 1347 of file path_util.c.
References BLI_dir_create_recursive(), BLI_split_dir_part(), and FILE_MAX.
Referenced by BKE_imbuf_write(), BKE_packedfile_compare_to_file(), blender::compositor::OutputOpenExrMultiLayerOperation::deinitExecution(), dynamicPaint_outputSurfaceImage(), blender::compositor::OutputOpenExrSingleLayerMultiViewOperation::get_handle(), blender::compositor::OutputOpenExrMultiLayerMultiViewOperation::get_handle(), IMB_index_builder_create(), movieclip_build_proxy_ibuf(), ptcache_file_open(), RE_RenderAnim(), RE_WriteRenderResult(), seq_disk_cache_create_version_file(), seq_disk_cache_read_file(), seq_disk_cache_write_file(), seq_proxy_build_frame(), and sequencer_export_subtitles_exec().
| void BLI_make_file_string | ( | const char * | relabase, |
| char * | string, | ||
| const char * | dir, | ||
| const char * | file | ||
| ) |
Returns in string the concatenation of dir and file (also with relabase on the front if specified and dir begins with "//"). Normalizes all occurrences of path separators, including ensuring there is exactly one between the copies of dir and file, and between the copies of relabase and dir.
| relabase | Optional prefix to substitute for "//" on front of dir. |
| string | Area to return result. |
Definition at line 1365 of file path_util.c.
References BLI_path_is_unc(), BLI_path_slash_native(), BLI_path_slash_rfind(), BLI_strncpy(), BLI_strnlen(), BLI_windows_get_default_root_dir(), ELEM, file, and NULL.
Referenced by icon_preview_imbuf_from_brush(), render_result_exr_file_cache_path(), and wm_autosave_location().
| bool BLI_path_abs | ( | char * | path, |
| const char * | basepath | ||
| ) |
If path begins with "//", strips that and replaces it with basepath directory.
| path | The path to convert. |
| basepath | The directory to base relative paths with. |
Definition at line 1016 of file path_util.c.
References BLI_path_is_rel(), BLI_path_normalize(), BLI_path_slash_rfind(), BLI_path_unc_prefix_len(), BLI_str_replace_char(), BLI_strncpy(), BLI_windows_get_default_root_dir(), ELEM, FILE_MAX, and NULL.
Referenced by blender::io::alembic::ArchiveReader::ArchiveReader(), BKE_bpath_relocate_visitor(), BKE_cachefile_filepath_get(), BKE_image_load(), BKE_image_load_exists_ex(), BKE_image_user_file_path(), BKE_library_filepath_set(), BKE_movieclip_file_add(), BKE_movieclip_file_add_exists_ex(), BKE_movieclip_filename_for_frame(), BKE_packedfile_compare_to_file(), BKE_packedfile_new(), BKE_packedfile_unpack_to_file(), BKE_sound_new_file(), BKE_sound_new_file_exists_ex(), BKE_text_file_modified_check(), BKE_text_file_modified_ignore(), BKE_text_load_ex(), BKE_text_reload(), BKE_vfont_load_exists_ex(), blf_dir_search(), BLI_path_normalize(), blo_do_versions_250(), bpath_absolute_convert_visit_cb(), bpath_relative_rebase_visit_cb(), bpy_lib_load(), bpy_lib_write(), customdata_external_filename(), detect_clip_source(), do_makepicstring(), dynamicPaint_outputSurfaceImage(), file_browse_exec(), file_expand_directory(), file_operator_to_sfile(), blender::io::gpencil::GpencilIO::filename_set(), fileselect_ensure_updated_file_params(), fluid_bake_startjob(), fluid_validatepaths(), get_proxy_fname(), get_sequence_fname(), icon_preview_imbuf_from_brush(), image_save_options_from_op(), image_save_options_init(), image_save_sequence_exec(), image_update_views_format(), meshcache_do(), movieclip_open_anim_file(), namebutton_fn(), open_invoke(), ptcache_path(), rewrite_path_alloc(), rewrite_path_fixed(), rewrite_path_fixed_dirfile(), screenshot_exec(), SEQ_add_image_init_alpha_mode(), SEQ_add_image_strip(), SEQ_add_movie_strip(), SEQ_add_reload_new_file(), SEQ_effect_text_font_load(), seq_open_anim_file(), seq_proxy_get_custom_file_fname(), seq_proxy_get_fname(), seq_proxy_multiview_context_invalid(), seq_render_image_strip(), sequencer_generic_invoke_path__internal(), sound_mixdown_exec(), and txt_write_file().
| bool BLI_path_abs_from_cwd | ( | char * | path, |
| const size_t | maxlen | ||
| ) |
Checks for relative path, expanding them relative to the current working directory. Returns true if the expansion was performed.
Definition at line 1128 of file path_util.c.
References BLI_current_working_dir(), BLI_join_dirfile(), BLI_path_is_unc(), BLI_strncpy(), and FILE_MAX.
Referenced by arg_handle_load_file(), arg_handle_python_file_run(), and where_am_i().
| void BLI_path_append | ( | char *__restrict | dst, |
| const size_t | maxlen, | ||
| const char *__restrict | file | ||
| ) |
Append a filename to a dir, ensuring slash separates.
Definition at line 1716 of file path_util.c.
References BLI_strncpy(), BLI_strnlen(), file, and SEP.
Referenced by BLI_path_program_search(), file_directory_enter_handle(), file_exec(), get_index_dir(), seq_disk_cache_get_dir(), seq_disk_cache_get_file_path(), seq_disk_cache_get_project_dir(), seq_disk_cache_handle_versioning(), and seq_proxy_index_dir_set().
| const char* BLI_path_basename | ( | const char * | path | ) |
like Python's os.path.basename()
Definition at line 1868 of file path_util.c.
References BLI_path_slash_rfind().
Referenced by BKE_image_add_from_imbuf(), BKE_image_load(), BKE_movieclip_file_add(), BKE_sound_new_file(), BKE_text_load_ex(), blo_find_main(), cachefile_open_exec(), fileentry_uiname(), import_startjob(), load_data_init_from_operator(), missing_files_find__visit_cb(), recent_files_menu_draw(), render_result_exr_file_path(), sig_handle_crash(), uiTemplateRecentFiles(), wm_autosave_location(), and wm_file_write().
| const char* BLI_path_extension | ( | const char * | filepath | ) |
Returns a pointer to the last extension (e.g. the position of the last period). Returns NULL if there is no extension.
Definition at line 1699 of file path_util.c.
References BLI_path_slash_find(), and NULL.
Referenced by ED_text_is_syntax_highlight_supported(), seq_disk_cache_get_files(), and TEST().
| bool BLI_path_extension_check | ( | const char * | str, |
| const char * | ext | ||
| ) |
Definition at line 1459 of file path_util.c.
References path_extension_check_ex(), and str.
Referenced by BKE_image_is_openexr(), BLI_file_alias_target(), BLI_file_attributes(), BLI_path_parent_dir(), BPY_modules_load_user(), do_add_image_extension(), ED_path_extension_type(), init_iconfile_list(), Freestyle::Controller::InsertStyleModule(), RE_WriteRenderViewsImage(), studiolight_add_file(), and wm_gpencil_import_svg_common_check().
| bool BLI_path_extension_check_array | ( | const char * | str, |
| const char ** | ext_array | ||
| ) |
Definition at line 1487 of file path_util.c.
References path_extension_check_ex(), and str.
Referenced by BKE_image_load(), BLO_has_bfile_extension(), do_add_image_extension(), ED_path_extension_type(), image_replace_exec(), imb_is_filepath_format(), and studiolight_add_file().
| bool BLI_path_extension_check_glob | ( | const char * | str, |
| const char * | ext_fnmatch | ||
| ) |
Semicolon separated wildcards, eg: *.zip;*.py;*.exe does str match any of the semicolon-separated glob patterns in #fnmatch.
Definition at line 1506 of file path_util.c.
References BLI_strncpy(), BLI_strncpy_rlen(), and str.
Referenced by filelist_readjob_list_dir().
| bool BLI_path_extension_check_n | ( | const char * | str, |
| ... | |||
| ) |
Definition at line 1464 of file path_util.c.
References path_extension_check_ex(), ret, and str.
Referenced by BKE_image_alpha_mode_from_extension_ex(), do_add_image_extension(), and ED_path_extension_type().
| bool BLI_path_extension_ensure | ( | char * | path, |
| size_t | maxlen, | ||
| const char * | ext | ||
| ) |
Strip's trailing '.'s and adds the extension only when needed
Definition at line 1601 of file path_util.c.
References Freestyle::a, and STREQ.
Referenced by BKE_cachefile_filepath_get(), blend_save_check(), do_add_image_extension(), make_temp_filepath(), sequencer_export_subtitles_exec(), and wm_gpencil_import_svg_common_check().
| bool BLI_path_extension_glob_validate | ( | char * | ext_fnmatch | ) |
Does basic validation of the given glob string, to prevent common issues from string truncation.
For now, only forbids last group to be a wildcard-only one, if there are more than one group (i.e. things like *.txt;*.cpp;* are changed to *.txt;*.cpp;)
Definition at line 1541 of file path_util.c.
References ELEM.
Referenced by fileselect_ensure_updated_file_params().
| bool BLI_path_extension_replace | ( | char * | path, |
| size_t | maxlen, | ||
| const char * | ext | ||
| ) |
Removes any existing extension on the end of path and appends ext.
Definition at line 1571 of file path_util.c.
References Freestyle::a, and ELEM.
Referenced by BLI_path_to_display_name(), cachefile_open_invoke(), do_add_image_extension(), filelist_readjob_list_dir(), imb_cache_filename(), render_result_exr_file_cache_path(), screenshot_invoke(), sequencer_export_subtitles_invoke(), sig_handle_crash(), volume_import_exec(), and write_crash_blend().
| bool BLI_path_filename_ensure | ( | char * | filepath, |
| size_t | maxlen, | ||
| const char * | filename | ||
| ) |
Definition at line 1633 of file path_util.c.
References BLI_path_slash_rfind(), and Freestyle::c.
Referenced by wm_filepath_default().
| bool BLI_path_frame | ( | char * | path, |
| int | frame, | ||
| int | digits | ||
| ) |
Replaces "#" character sequence in last slash-separated component of path with frame as decimal integer, with leading zeroes as necessary, to make digits digits.
Definition at line 802 of file path_util.c.
References BLI_snprintf(), BLI_strncpy(), ensure_digits(), FILE_MAX, and stringframe_chars().
Referenced by BKE_cachefile_filepath_get(), do_makepicstring(), dynamicPaint_bakeImageSequence(), get_proxy_fname(), sequencer_image_seq_reserve_frames(), and TEST().
| bool BLI_path_frame_check_chars | ( | const char * | path | ) |
Check if we have '#' chars, usable for BLI_path_frame, BLI_path_frame_range
Definition at line 958 of file path_util.c.
References stringframe_chars().
| bool BLI_path_frame_get | ( | char * | path, |
| int * | r_frame, | ||
| int * | r_numdigits | ||
| ) |
Get the frame from a filename formatted by blender's frame scheme
Definition at line 854 of file path_util.c.
References BLI_path_slash_rfind(), Freestyle::c, file, len, and NULL.
Referenced by BKE_cachefile_filepath_get(), sequencer_image_seq_get_minmax_frame(), and volume_sequence_frame().
| bool BLI_path_frame_range | ( | char * | path, |
| int | sta, | ||
| int | end, | ||
| int | digits | ||
| ) |
Replaces "#" character sequence in last slash-separated component of path with sta and end as decimal integers, with leading zeroes as necessary, to make digits digits each, with a hyphen in-between.
Definition at line 825 of file path_util.c.
References BLI_snprintf(), BLI_strncpy(), ensure_digits(), FILE_MAX, and stringframe_chars().
| void BLI_path_frame_strip | ( | char * | path, |
| char * | ext | ||
| ) |
Definition at line 906 of file path_util.c.
References BLI_path_slash_rfind(), BLI_strncpy(), Freestyle::c, file, len, and NULL.
Referenced by BKE_cachefile_filepath_get(), and sequencer_image_seq_reserve_frames().
| bool BLI_path_is_rel | ( | const char * | path | ) |
Does path begin with the special "//" prefix that Blender uses to indicate a path relative to the .blend file.
Definition at line 411 of file path_util.c.
Referenced by BKE_bpath_relocate_visitor(), BKE_library_filepath_set(), BKE_packedfile_pack_all_libraries(), BLI_access(), BLI_delete(), BLI_delete_soft(), BLI_exists(), BLI_fopen(), BLI_gzopen(), BLI_open(), BLI_path_abs(), BLI_path_rel(), bpath_absolute_convert_visit_cb(), bpath_relative_convert_visit_cb(), bpath_relative_rebase_visit_cb(), ED_image_filesel_detect_sequences(), file_browse_invoke(), file_expand_directory(), fix_relpaths_library(), image_replace_invoke(), imb_get_anim_type(), imb_ispic_read_header_from_filepath(), IMB_loadiffname(), IMB_open_anim(), IMB_saveiff(), IMB_testiffname(), missing_files_find__visit_cb(), and ptcache_path().
| bool BLI_path_is_unc | ( | const char * | path | ) |
Definition at line 417 of file path_util.c.
Referenced by BLI_make_file_string(), BLI_path_abs_from_cwd(), BLI_path_rel(), BLI_path_unc_prefix_len(), and file_expand_directory().
| size_t BLI_path_join | ( | char *__restrict | dst, |
| const size_t | dst_len, | ||
| const char * | path_first, | ||
| ... | |||
| ) |
Referenced by MANTA::bakeData(), MANTA::bakeGuiding(), MANTA::bakeMesh(), MANTA::bakeNoise(), MANTA::bakeParticles(), BKE_appdir_app_template_has_userpref(), BKE_appdir_folder_documents(), BKE_blendfile_userdef_write_all(), BKE_preferences_asset_library_default_add(), BlendfileLoadingBaseTest::blendfile_load(), MANTA::exportLiquidScript(), MANTA::exportSmokeScript(), fluid_bake_startjob(), fsmenu_xdg_insert_entry(), fsmenu_xdg_user_dirs_parse(), get_path_local_ex(), get_path_system_ex(), recursive_operation(), blender::io::usd::TEST_F(), test_path(), wm_block_create_splash(), wm_homefile_read(), and wm_homefile_write_exec().
| bool BLI_path_make_safe | ( | char * | path | ) |
Make given path OS-safe.
Definition at line 374 of file path_util.c.
References backup, BLI_filename_make_safe(), and BLI_path_slash_find().
Referenced by MANTA::bakeData(), MANTA::bakeGuiding(), MANTA::bakeMesh(), MANTA::bakeNoise(), MANTA::bakeParticles(), MANTA::exportLiquidScript(), MANTA::exportSmokeScript(), file_directory_new_exec(), and image_save_options_init().
| bool BLI_path_name_at_index | ( | const char *__restrict | path, |
| const int | index, | ||
| int *__restrict | r_offset, | ||
| int *__restrict | r_len | ||
| ) |
Get an element of the path at an index, eg: "/some/path/file.txt" where an index of...
Ignores multiple slashes at any point in the path (including start/end).
Definition at line 1883 of file path_util.c.
References ALTSEP, Freestyle::c, ELEM, and SEP.
Referenced by fsmenu_entry_generate_name().
| void BLI_path_normalize | ( | const char * | relabase, |
| char * | path | ||
| ) |
Remove redundant characters from path and optionally make absolute.
| relabase | The path this is relative to, or ignored when NULL. |
| path | Can be any input, and this function converts it to a regular full path. Also removes garbage from directory paths, like /../ or double slashes etc. |
Definition at line 173 of file path_util.c.
References Freestyle::a, BLI_path_abs(), and BLI_path_unc_prefix_len().
Referenced by BKE_bpath_relocate_visitor(), BLI_path_abs(), BLI_path_normalize_dir(), BLI_path_parent_dir(), BLI_path_rel(), blo_find_main(), BLO_write_file(), bpath_relative_rebase_visit_cb(), direct_link_library(), file_exec(), get_path_local_ex(), Freestyle::StringUtils::getPathName(), Freestyle::Controller::LoadMesh(), TEST(), and where_am_i().
| void BLI_path_normalize_dir | ( | const char * | relabase, |
| char * | dir | ||
| ) |
Cleanup filepath ensuring a trailing slash.
Definition at line 266 of file path_util.c.
References BLI_path_normalize(), and BLI_path_slash_ensure().
Referenced by bookmark_select_exec(), file_directory_enter_handle(), file_filename_enter_handle(), file_parent_exec(), file_select_do(), filelist_readjob_do(), filelist_setdir(), and fileselect_ensure_updated_file_params().
| bool BLI_path_parent_dir | ( | char * | path | ) |
Replaces path with the path of its parent directory, returning true if it was able to find a parent directory within the path.
Definition at line 708 of file path_util.c.
References BLI_join_dirfile(), BLI_path_extension_check(), BLI_path_normalize(), FILE_MAX, NULL, and SEP.
Referenced by bli_builddir(), BLI_path_parent_dir_until_exists(), file_exec(), file_parent_exec(), file_select_do(), open_invoke(), and wm_link_append_invoke().
| bool BLI_path_parent_dir_until_exists | ( | char * | dir | ) |
Strips off nonexistent (or non-accessible) sub-directories from the end of dir, leaving the path of the lowest-level directory that does exist and we can read.
Definition at line 728 of file path_util.c.
References BLI_access(), and BLI_path_parent_dir().
Referenced by parent_dir_until_exists_or_default_root().
| bool BLI_path_program_search | ( | char * | fullname, |
| const size_t | maxlen, | ||
| const char * | name | ||
| ) |
Search for a binary (executable)
Definition at line 1218 of file path_util.c.
References BLI_exists(), BLI_getenv(), BLI_path_append(), BLI_strncpy(), and FILE_MAX.
Referenced by BKE_appdir_program_python_search(), and where_am_i().
| void BLI_path_rel | ( | char * | file, |
| const char * | relfile | ||
| ) |
Replaces file with a relative version (prefixed by "//") such that BLI_path_abs, given the same relfile, will convert it back to its original value.
Definition at line 519 of file path_util.c.
References BLI_path_is_rel(), BLI_path_is_unc(), BLI_path_normalize(), BLI_path_slash_rfind(), BLI_path_unc_prefix_len(), BLI_str_replace_char(), BLI_strcpy_rlen(), BLI_strncpy(), BLI_strncpy_rlen(), BLI_strnlen(), BLI_windows_get_default_root_dir(), file, FILE_MAX, NULL, and r.
Referenced by BKE_bpath_relocate_visitor(), bpath_relative_convert_visit_cb(), bpath_relative_rebase_visit_cb(), ED_image_filesel_detect_sequences(), file_browse_exec(), file_sfile_to_operator_ex(), filelist_readjob_do(), fix_relpaths_library(), fluid_validatepaths(), image_open_single(), image_save_post(), library_link_end(), load_data_init_from_operator(), missing_files_find__visit_cb(), multires_external_save_exec(), open_exec(), sequencer_change_path_exec(), volume_import_exec(), and WM_operator_drop_load_path().
| int BLI_path_sequence_decode | ( | const char * | string, |
| char * | head, | ||
| char * | tail, | ||
| ushort * | r_num_len | ||
| ) |
Looks for a sequence of decimal digits in string, preceding any filename extension, returning the integer value if found, or 0 if not.
| string | String to scan. |
| head | Optional area to return copy of part of string prior to digits, or before dot if no digits. |
| tail | Optional area to return copy of part of string following digits, or from dot if no digits. |
| r_num_len | Optional to return number of digits found. |
Definition at line 83 of file path_util.c.
References BLI_path_slash_rfind(), BLI_strncpy(), NULL, and ret.
Referenced by BKE_image_save(), BKE_image_sequence_guess_offset(), BKE_image_user_file_path(), build_pict_list_ex(), filenum_newname(), get_sequence_fname(), image_get_udim(), image_save_options_init(), image_sequence_get_frame_ranges(), movieclip_calc_length(), put_imbuf_cache(), and user_frame_to_cache_frame().
| void BLI_path_sequence_encode | ( | char * | string, |
| const char * | head, | ||
| const char * | tail, | ||
| unsigned short | numlen, | ||
| int | pic | ||
| ) |
Returns in area pointed to by string a string of the form "<head><pic><tail>", where pic is formatted as numlen digits with leading zeroes.
Definition at line 154 of file path_util.c.
References MAX2.
Referenced by an_stringenc(), BKE_image_save(), BKE_image_user_file_path(), build_pict_list_ex(), filenum_newname(), get_sequence_fname(), and image_get_udim().
| int BLI_path_slash_ensure | ( | char * | string | ) |
Appends a slash to string if there isn't one there already. Returns the new length of the string.
Definition at line 1981 of file path_util.c.
Referenced by autocomplete_directory(), BLI_path_normalize_dir(), file_browse_exec(), file_exec(), file_select_do(), filelist_geticon_ex(), filelist_readjob_list_dir(), ptcache_path(), seq_disk_cache_delete_invalid_files(), seq_disk_cache_get_files(), tempdir_session_create(), and where_is_temp().
| const char* BLI_path_slash_find | ( | const char * | string | ) |
Returns pointer to the leftmost path separator in string. Not actually used anywhere.
Definition at line 1944 of file path_util.c.
Referenced by BLI_path_extension(), and BLI_path_make_safe().
| void BLI_path_slash_native | ( | char * | path | ) |
Changes to the path separators to the native ones for this OS.
Definition at line 2012 of file path_util.c.
References BLI_path_unc_prefix_len(), BLI_str_replace_char(), and BLI_strnlen().
Referenced by BLI_make_file_string(), clean_paths(), and clean_paths_visit_cb().
| const char* BLI_path_slash_rfind | ( | const char * | string | ) |
Returns pointer to the rightmost path separator in string.
Definition at line 1962 of file path_util.c.
Referenced by BLI_dir_create_recursive(), BLI_make_file_string(), BLI_path_abs(), BLI_path_basename(), BLI_path_filename_ensure(), BLI_path_frame_get(), BLI_path_frame_strip(), BLI_path_rel(), BLI_path_sequence_decode(), BLI_split_dirfile(), BLO_library_path_explode(), check_destination(), ensure_digits(), file_browse_exec(), file_browse_invoke(), groupname_to_code(), is_hidden_dot_filename(), uiTemplateImageInfo(), uiTemplateMovieclipInformation(), where_am_i(), and wm_open_mainfile_check().
| void BLI_path_slash_rstrip | ( | char * | string | ) |
Removes the last slash and everything after it to the end of string, if there is one.
Definition at line 1995 of file path_util.c.
Referenced by BLI_dir_create_recursive(), file_path_to_ui_path(), and strip_last_slash().
| bool BLI_path_suffix | ( | char * | string, |
| size_t | maxlen, | ||
| const char * | suffix, | ||
| const char * | sep | ||
| ) |
Appends a suffix to the string, fitting it before the extension
string = Foo.png, suffix = 123, separator = _ Foo.png -> Foo_123.png
| string | original (and final) string |
| maxlen | Maximum length of string |
| suffix | String to append to the original string |
| sep | Optional separator character |
Definition at line 669 of file path_util.c.
References Freestyle::a, BLI_strncpy(), ELEM, and FILE_MAX.
Referenced by bake_targets_output_external(), BKE_image_memorypack(), BKE_scene_multiview_filepath_get(), BKE_scene_multiview_view_filepath_get(), and do_makepicstring().
| void BLI_path_to_display_name | ( | char * | display_name, |
| int | maxlen, | ||
| const char * | name | ||
| ) |
Creates a display string from path to be used menus and the user interface. Like bpy.path.display_name().
Definition at line 968 of file path_util.c.
References BLI_path_extension_replace(), BLI_str_replace_char(), BLI_strncpy(), and ELEM.
Referenced by workspace_add_invoke().
| void BLI_setenv | ( | const char * | env, |
| const char * | val | ||
| ) |
Sets the specified environment variable to the specified value, and clears it if val == NULL.
Definition at line 1274 of file path_util.c.
References uputenv().
Referenced by arg_handle_env_system_set(), and BLI_setenv_if_new().
| void BLI_setenv_if_new | ( | const char * | env, |
| const char * | val | ||
| ) |
Only set an env var if already not there. Like Unix setenv(env, val, 0);
(not used anywhere).
Definition at line 1298 of file path_util.c.
References BLI_getenv(), BLI_setenv(), and NULL.
| void BLI_split_dir_part | ( | const char * | string, |
| char * | dir, | ||
| const size_t | dirlen | ||
| ) |
Copies the parent directory part of string into dir, max length dirlen.
Definition at line 1682 of file path_util.c.
References BLI_split_dirfile(), and NULL.
Referenced by autocomplete_directory(), BKE_appdir_program_path_init(), BLI_make_existing_file(), BLO_write_file(), file_sfile_filepath_set(), fileselect_initialize_params_common(), image_save_sequence_exec(), sequencer_add_image_strip_load_files(), WM_file_autoexec_init(), and DocumentImporter::writeImage().
| void BLI_split_dirfile | ( | const char * | string, |
| char * | dir, | ||
| char * | file, | ||
| const size_t | dirlen, | ||
| const size_t | filelen | ||
| ) |
Converts /foo/bar.txt to /foo/ and bar.txt
Definition at line 1654 of file path_util.c.
References BLI_path_slash_rfind(), BLI_strncpy(), file, and MIN2.
Referenced by BLI_file_is_writable(), BLI_split_dir_part(), BLI_split_file_part(), clip_drop_copy(), do_versions_nodetree_multi_file_output_format_2_62_1(), file_directory_enter_handle(), file_exec(), file_operator_to_sfile(), file_sfile_filepath_set(), fileselect_ensure_updated_file_params(), get_index_dir(), get_proxy_fname(), image_get_udim(), IMB_anim_get_fname(), lib_relocate(), render_result_exr_file_cache_path(), rewrite_path_fixed_dirfile(), SEQ_add_movie_strip(), seq_disk_cache_add_file_to_list(), seq_disk_cache_get_files(), sequencer_drop_copy(), TEST(), ui_but_menu_add_path_operators(), and unpack_generate_paths().
| void BLI_split_file_part | ( | const char * | string, |
| char * | file, | ||
| const size_t | filelen | ||
| ) |
Copies the leaf filename part of string into file, max length filelen.
Definition at line 1690 of file path_util.c.
References BLI_split_dirfile(), file, and NULL.
Referenced by BKE_studiolight_create(), BKE_vfont_load(), BKE_volume_load(), block_create__close_file_dialog(), ptcache_path(), seq_disk_cache_get_project_dir(), studiolight_add_file(), unpack_menu(), and volume_import_exec().