|  | Home · All Classes · Modules

# QFSFileEngine Class Reference
[QtCore module]

The QFSFileEngine class implements Qt's default file engine. More...

Inherits QAbstractFileEngine.

### Methods

- __init__ (self)
- __init__ (self, QStringQString)
- bool caseSensitive (self)
- bool close (self)
- bool copy (self, QStringQString)
- QStringListQStringList entryList (self, QDir.Filters, QStringListQStringList)
- QAbstractFileEngine.FileFlags fileFlags (self, QAbstractFileEngine.FileFlags)
- QStringQString fileName (self, QAbstractFileEngine.FileName)
- QDateTime fileTime (self, QAbstractFileEngine.FileTime)
- bool flush (self)
- int handle (self)
- bool isRelativePath (self)
- bool isSequential (self)
- bool link (self, QStringQString)
- bool mkdir (self, QStringQString, bool)
- bool open (self, QIODevice.OpenMode)
- bool open (self, QIODevice.OpenMode, int)
- QStringQString owner (self, QAbstractFileEngine.FileOwner)
- int ownerId (self, QAbstractFileEngine.FileOwner)
- int pos (self)
- str read (self, int maxlen)
- str readLine (self, int maxlen)
- bool remove (self)
- bool rename (self, QStringQString)
- bool rmdir (self, QStringQString, bool)
- bool seek (self, int)
- setFileName (self, QStringQString)
- bool setPermissions (self, int)
- bool setSize (self, int)
- int size (self)
- int write (self, str)

### Static Methods

- QStringQString currentPath (QStringQString fileName = QString())
- QList<QFileInfo>list-of-QFileInfo drives ()
- QStringQString homePath ()
- QStringQString rootPath ()
- bool setCurrentPath (QStringQString)
- QStringQString tempPath ()

## Detailed Description

The QFSFileEngine class implements Qt's default file engine.

This class is part of the file engine framework in Qt. If you only want to access files or directories, use QFile, QFileInfo or QDir instead.

QFSFileEngine is the default file engine for accessing regular files. It is provided for convenience; by subclassing this class, you can alter its behavior slightly, without having to write a complete QAbstractFileEngine subclass. To install your custom file engine, you must also subclass QAbstractFileEngineHandler and create an instance of your handler.

It can also be useful to create a QFSFileEngine object directly if you need to use the local file system inside QAbstractFileEngine.create(), in order to avoid recursion (as higher-level classes tend to call QAbstractFileEngine.create()).

## Method Documentation

### QFSFileEngine.__init__ (self)

Constructs a QFSFileEngine.

### QFSFileEngine.__init__ (self, QStringQString)

Constructs a QFSFileEngine for the file name file.

### bool QFSFileEngine.caseSensitive (self)

Reimplemented from QAbstractFileEngine.caseSensitive().

Returns true for Windows, false for Unix.

### bool QFSFileEngine.close (self)

Reimplemented from QAbstractFileEngine.close().

### bool QFSFileEngine.copy (self, QStringQString)

Reimplemented from QAbstractFileEngine.copy().

For windows, copy the file to file copyName.

Not implemented for Unix.

### QStringQString QFSFileEngine.currentPath (QStringQString fileName = QString())

For Unix, returns the current working directory for the file engine.

For Windows, returns the canonicalized form of the current path used by the file engine for the drive specified by fileName. On Windows, each drive has its own current directory, so a different path is returned for file names that include different drive names (e.g. A: or C:).

See also setCurrentPath().

### QList<QFileInfo>list-of-QFileInfo QFSFileEngine.drives ()

For Windows, returns the list of drives in the file system as a list of QFileInfo objects. On unix, Mac OS X and Windows CE, only the root path is returned. On Windows, this function returns all drives (A:, C:, D:, etc.).

For Unix, the list contains just the root path "/".

### QStringListQStringList QFSFileEngine.entryList (self, QDir.Filters, QStringListQStringList)

### QAbstractFileEngine.FileFlags QFSFileEngine.fileFlags (self, QAbstractFileEngine.FileFlags)

Reimplemented from QAbstractFileEngine.fileFlags().

### QStringQString QFSFileEngine.fileName (self, QAbstractFileEngine.FileName)

Reimplemented from QAbstractFileEngine.fileName().

See also setFileName().

### QDateTime QFSFileEngine.fileTime (self, QAbstractFileEngine.FileTime)

Reimplemented from QAbstractFileEngine.fileTime().

### bool QFSFileEngine.flush (self)

Reimplemented from QAbstractFileEngine.flush().

### int QFSFileEngine.handle (self)

Reimplemented from QAbstractFileEngine.handle().

### QStringQString QFSFileEngine.homePath ()

Returns the home path of the current user.

See also rootPath().

### bool QFSFileEngine.isRelativePath (self)

Reimplemented from QAbstractFileEngine.isRelativePath().

### bool QFSFileEngine.isSequential (self)

Reimplemented from QAbstractFileEngine.isSequential().

### bool QFSFileEngine.link (self, QStringQString)

Reimplemented from QAbstractFileEngine.link().

Creates a link from the file currently specified by fileName() to newName. What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.

### bool QFSFileEngine.mkdir (self, QStringQString, bool)

Reimplemented from QAbstractFileEngine.mkdir().

### bool QFSFileEngine.open (self, QIODevice.OpenMode)

Reimplemented from QAbstractFileEngine.open().

### bool QFSFileEngine.open (self, QIODevice.OpenMode, int)

Opens the file handle fh in openMode mode. Returns true on success; otherwise returns false.

### QStringQString QFSFileEngine.owner (self, QAbstractFileEngine.FileOwner)

Reimplemented from QAbstractFileEngine.owner().

### int QFSFileEngine.ownerId (self, QAbstractFileEngine.FileOwner)

Reimplemented from QAbstractFileEngine.ownerId().

In Unix, if stat() is successful, the `uid` is returned if own is the owner. Otherwise the `gid` is returned. If stat() is unsuccessful, -2 is reuturned.

For Windows, -2 is always returned.

### int QFSFileEngine.pos (self)

Reimplemented from QAbstractFileEngine.pos().

### str QFSFileEngine.read (self, int maxlen)

Reimplemented from QAbstractFileEngine.read().

### str QFSFileEngine.readLine (self, int maxlen)

Reimplemented from QAbstractFileEngine.readLine().

### bool QFSFileEngine.remove (self)

Reimplemented from QAbstractFileEngine.remove().

### bool QFSFileEngine.rename (self, QStringQString)

Reimplemented from QAbstractFileEngine.rename().

### bool QFSFileEngine.rmdir (self, QStringQString, bool)

Reimplemented from QAbstractFileEngine.rmdir().

### QStringQString QFSFileEngine.rootPath ()

Returns the root path.

See also homePath().

### bool QFSFileEngine.seek (self, int)

Reimplemented from QAbstractFileEngine.seek().

### bool QFSFileEngine.setCurrentPath (QStringQString)

Sets the current path (e.g., for QDir), to path. Returns true if the new path exists; otherwise this function does nothing, and returns false.

See also currentPath().

### QFSFileEngine.setFileName (self, QStringQString)

Reimplemented from QAbstractFileEngine.setFileName().

See also fileName().

### bool QFSFileEngine.setPermissions (self, int)

Reimplemented from QAbstractFileEngine.setPermissions().

### bool QFSFileEngine.setSize (self, int)

Reimplemented from QAbstractFileEngine.setSize().

See also size().

### int QFSFileEngine.size (self)

Reimplemented from QAbstractFileEngine.size().

See also setSize().

### QStringQString QFSFileEngine.tempPath ()

Returns the temporary path (i.e., a path in which it is safe to store temporary files).

### int QFSFileEngine.write (self, str)

Reimplemented from QAbstractFileEngine.write().