|  | Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QFSFileEngine Class Reference
[QtCore module]

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

     #include <QFSFileEngine>

Inherits QAbstractFileEngine.

This class was introduced in Qt 4.1.

- List of all members, including inherited members

### Public Types

- typedef Iterator

### Public Functions

- QFSFileEngine ()
- QFSFileEngine ( const QString & file )
- ~QFSFileEngine ()
- virtual bool caseSensitive () const
- virtual bool copy ( const QString & copyName )
- virtual bool link ( const QString & newName )
- bool open ( QIODevice::OpenMode openMode, FILE * fh )
- bool open ( QIODevice::OpenMode openMode, int fd )
- virtual uint ownerId ( FileOwner own ) const

- 36 public functions inherited from QAbstractFileEngine

### Static Public Members

- QString currentPath ( const QString & fileName = QString() )
- QFileInfoList drives ()
- QString homePath ()
- QString rootPath ()
- bool setCurrentPath ( const QString & path )
- QString tempPath ()

- 1 static public member inherited from QAbstractFileEngine

### Additional Inherited Members

- 1 protected function inherited from QAbstractFileEngine

## 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()).

## Member Function Documentation

### QFSFileEngine::QFSFileEngine ()

Constructs a QFSFileEngine.

### QFSFileEngine::QFSFileEngine ( const QString & file )

Constructs a QFSFileEngine for the file name file.

### QFSFileEngine::~QFSFileEngine ()

Destructs the QFSFileEngine.

### bool QFSFileEngine::caseSensitive () const `[virtual]`

Returns true for Windows, false for Unix.

Reimplemented from QAbstractFileEngine.

### bool QFSFileEngine::copy ( const QString & copyName ) `[virtual]`

For windows, copy the file to file copyName.

Not implemented for Unix.

Reimplemented from QAbstractFileEngine.

### QString QFSFileEngine::currentPath ( const QString & fileName = QString() ) `[static]`

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().

### QFileInfoList QFSFileEngine::drives () `[static]`

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 "/".

### QString QFSFileEngine::homePath () `[static]`

Returns the home path of the current user.

See also rootPath().

### bool QFSFileEngine::link ( const QString & newName ) `[virtual]`

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.

Reimplemented from QAbstractFileEngine.

### bool QFSFileEngine::open ( QIODevice::OpenMode openMode, FILE * fh )

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

### bool QFSFileEngine::open ( QIODevice::OpenMode openMode, int fd )

Opens the file descriptor fd in openMode mode. Returns true on success; otherwise returns false.

### uint QFSFileEngine::ownerId ( FileOwner own ) const `[virtual]`

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.

Reimplemented from QAbstractFileEngine.

### QString QFSFileEngine::rootPath () `[static]`

Returns the root path.

See also homePath().

### bool QFSFileEngine::setCurrentPath ( const QString & path ) `[static]`

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().

### QString QFSFileEngine::tempPath () `[static]`

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