************* wx.FileSystem ************* Inheritance diagram for `wx.FileSystem`: | .. inheritance-diagram:: wx.FileSystem | Description =========== This class provides an interface for opening files on different file systems. It can handle absolute and/or local filenames. It uses a system of handlers to provide access to user-defined virtual file systems. .. seealso:: `wx.FileSystemHandler `_, `wx.FSFile `_ Derived From ^^^^^^^^^^^^^ * `wx.Object `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddHandler <#AddHandler>`_ * `ChangePathTo <#ChangePathTo>`_ * `CleanUpHandlers <#CleanUpHandlers>`_ * `FileNameToURL <#FileNameToURL>`_ * `FindFirst <#FindFirst>`_ * `FindNext <#FindNext>`_ * `GetPath <#GetPath>`_ * `OpenFile <#OpenFile>`_ * `RemoveHandler <#RemoveHandler>`_ * `URLToFileName <#URLToFileName>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Path <#Path>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() `No docstrings available for this method.` -------- .. method:: AddHandler(handler) This static function adds new handler into the list of handlers which provide access to virtual FS. Note that if two handlers for the same protocol are added, the last one added takes precedence. **Parameters:** * `handler` (`wx.FileSystemHandler `_) -------- .. method:: ChangePathTo(location, is_dir=False) Sets the current location. `location` parameter passed to `OpenFile <#OpenFile>`_ is relative to this path. **Parameters:** * `location` (string): the new location. Its meaning depends on the value of `is_dir` * `is_dir` (bool): if ``True`` `location` is new directory. If ``False`` (default) `location` is **file in** the new directory. .. warning:: Unless `is_dir` is ``True`` the `location` parameter is not the directory name but the name of the file in this directory. All these commands change the path to "dir/subdir/":: ChangePathTo("dir/subdir/xh.htm") ChangePathTo("dir/subdir", True) ChangePathTo("dir/subdir/", True) -------- .. method:: CleanUpHandlers() `No docstrings available for this method.` -------- .. method:: FileNameToURL(filename) Converts filename into URL. **Parameters:** * `filename` (string) | **Returns:** `string` .. seealso:: `URLToFileName <#URLToFileName>`_ -------- .. method:: FindFirst(wildcard, flags=0) Returns name of the first filename (within filesystem's current path) that matches `wildcard`. `flags` may be one of ``wx.FILE`` (only files), ``wx.DIR`` (only directories) or 0 (both). **Parameters:** * `wildcard` (string) * `flags` (int) | **Returns:** `string` -------- .. method:: FindNext() Returns the next filename that matches parameters passed to `FindFirst <#FindFirst>`_. | **Returns:** `string` -------- .. method:: GetPath() Returns actual path (set by `ChangePathTo <#ChangePathTo>`_). | **Returns:** `string` -------- .. method:: OpenFile(location) Opens the file and returns a pointer to a `wx.FSFile `_ object or ``None`` if failed. It first tries to open the file in relative scope (based on value passed to `ChangePathTo()` method) and then as an absolute path. A stream opened with just the default ``wx.FS_READ`` flag may or may not be seekable depending on the underlying source. Passing ``wx.FS_READ`` | ``wx.FS_SEEKABLE`` for `flags` will back a stream that is not natively seekable with memory or a file and return a stream that is always seekable. **Parameters:** * `location` (string) | **Returns:** `wx.FSFile `_ .. note:: Note that the user is responsible for deleting the returned `wx.FSFile`. -------- .. method:: RemoveHandler(handler) | **Parameters:** * `handler` (`wx.CPPFileSystemHandler`) | **Returns:** `wx.CPPFileSystemHandler` -------- .. method:: URLToFileName(url) Converts URL into a well-formed filename. The URL must use the ``file`` protocol. **Parameters:** * `url` (string) | **Returns:** `string` -------- Properties ^^^^^^^^^^ .. attribute:: Path See `GetPath <#GetPath>`_