diff --git "a/2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.7 path utilities(bpy.path)" "b/2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.7 path utilities(bpy.path)" new file mode 100644 index 0000000000000000000000000000000000000000..1cc1eb39ae0bcfeec66e9227c186e4b354a6a97c --- /dev/null +++ "b/2. \354\225\240\355\224\214\353\246\254\354\274\200\354\235\264\354\205\230 \353\252\250\353\223\210/2.7 path utilities(bpy.path)" @@ -0,0 +1,120 @@ +Path Utilities (bpy.path) +This module has a similar scope to os.path, containing utility functions for dealing with paths in Blender. + +bpy.path.abspath(path, *, start=None, library=None) +Returns the absolute path relative to the current blend file using the “//” prefix. + +Parameters +start (string or bytes) – Relative to this path, when not set the current filename is used. + +library (bpy.types.Library) – The library this path is from. This is only included for convenience, when the library is not None its path replaces start. + +Returns +The absolute path. + +Return type +string + +bpy.path.basename(path) +Equivalent to os.path.basename, but skips a “//” prefix. + +Use for Windows compatibility. :return: The base name of the given path. :rtype: string + +bpy.path.clean_name(name, *, replace='_') +Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file. All characters besides A-Z/a-z, 0-9 are replaced with “_” or the replace argument if defined. :arg name: The path name. :type name: string or bytes :arg replace: The replacement for non-valid characters. :type replace: string :return: The cleaned name. :rtype: string + +bpy.path.display_name(name, *, has_ext=True, title_case=True) +Creates a display string from name to be used menus and the user interface. Intended for use with filenames and module names. + +Parameters +name (string) – The name to be used for displaying the user interface. + +has_ext (boolean) – Remove file extension from name. + +title_case (boolean) – Convert lowercase names to title case. + +Returns +The display string. + +Return type +string + +bpy.path.display_name_to_filepath(name) +Performs the reverse of display_name using literal versions of characters which aren’t supported in a filepath. :arg name: The display name to convert. :type name: string :return: The file path. :rtype: string + +bpy.path.display_name_from_filepath(name) +Returns the path stripped of directory and extension, ensured to be utf8 compatible. :arg name: The file path to convert. :type name: string :return: The display name. :rtype: string + +bpy.path.ensure_ext(filepath, ext, *, case_sensitive=False) +Return the path with the extension added if it is not already set. + +Parameters +filepath (string) – The file path. + +ext (string) – The extension to check for, can be a compound extension. Should start with a dot, such as ‘.blend’ or ‘.tar.gz’. + +case_sensitive (boolean) – Check for matching case when comparing extensions. + +Returns +The file path with the given extension. + +Return type +string + +bpy.path.is_subdir(path, directory) +Returns true if path in a subdirectory of directory. Both paths must be absolute. + +Parameters +path (string or bytes) – An absolute path. + +Returns +Whether or not the path is a subdirectory. + +Return type +boolean + +bpy.path.module_names(path, *, recursive=False) +Return a list of modules which can be imported from path. + +Parameters +path (string) – a directory to scan. + +recursive (bool) – Also return submodule names for packages. + +Returns +a list of string pairs (module_name, module_file). + +Return type +list of strings + +bpy.path.native_pathsep(path) +Replace the path separator with the systems native os.sep. :arg path: The path to replace. :type path: string :return: The path with system native separators. :rtype: string + +bpy.path.reduce_dirs(dirs) +Given a sequence of directories, remove duplicates and any directories nested in one of the other paths. (Useful for recursive path searching). + +Parameters +dirs (sequence of strings) – Sequence of directory paths. + +Returns +A unique list of paths. + +Return type +list of strings + +bpy.path.relpath(path, *, start=None) +Returns the path relative to the current blend file using the “//” prefix. + +Parameters +path (string or bytes) – An absolute path. + +start (string or bytes) – Relative to this path, when not set the current filename is used. + +Returns +The relative path. + +Return type +string + +bpy.path.resolve_ncase(path) +Resolve a case insensitive path on a case sensitive system, returning a string with the path if found else return the original path. :arg path: The path name to resolve. :type path: string :return: The resolved path. :rtype: string