:mod:`path` ============= .. module:: path :synopsis: Provides access to path modifications, globbing and so on. .. moduleauthor:: The Widelands development team .. currentmodule:: path Module Functions ^^^^^^^^^^^^^^^^ .. function:: basename(filename) Returns everything behind the last /. :type filename: class:`string` :arg filename: filename to return basename for. :returns: The basename. .. function:: dirname(filename) Everything before the final / in filename. The returned value is either the empty string or ends with a '/'. :type filename: class:`string` :arg filename: filename to return dirname for. :returns: The dirname. .. function:: list_files(filename_template) **DEPRECATED**. Lists the full path for all files that fit the template pattern. Use ? as placeholders for numbers, e.g. 'directory/idle\_??.png' will list 'directory/idle_00.png', 'directory/idle_01.png' etc, and 'directory/idle.png' will just list 'directory/idle.png'. Lua Tables need lots of memory, so only use this when you have to. :type filename_template: class:`string` :arg filename_template: The filename template to use for the listing. :returns: An :class:`array` of file paths in lexicographical order. .. function:: list_directory(filename) Returns all file names contained in the given directory. Lua Tables need lots of memory, so only use this when you have to. :type filename: class:`string` :arg filename: The directory to read. :returns: An :class:`array` of file names. .. function:: is_directory(filename) Checks whether the given filename points to a directory. :type filename: class:`string` :arg filename: The filename to check. :returns: ``true`` if the given path is a directory. .. function:: file_exists(filename) Checks whether the given filename points to a file or directory. :type filename: class:`string` :arg filename: The filename to check. :returns: ``true`` if the given path is a file or directory.