| QGIS API Documentation
    3.20.0-Odense (decaadbb31)
    | 
Class for file utilities. More...
#include <qgsfileutils.h>
| Static Public Member Functions | |
| static QString | addExtensionFromFilter (const QString &fileName, const QString &filter) | 
| Ensures that a fileName ends with an extension from the specified filter string.  More... | |
| static Qgis::DriveType | driveType (const QString &path) SIP_THROW(QgsNotSupportedException) | 
| Returns the drive type for the given path.  More... | |
| static QString | ensureFileNameHasExtension (const QString &fileName, const QStringList &extensions) | 
| Ensures that a fileName ends with an extension from the provided list of extensions.  More... | |
| static QStringList | extensionsFromFilter (const QString &filter) | 
| Returns a list of the extensions contained within a file filter string.  More... | |
| static bool | fileMatchesFilter (const QString &fileName, const QString &filter) | 
| Returns trueif the given fileName matches a file filter string.  More... | |
| static QString | findClosestExistingPath (const QString &path) | 
| Returns the top-most existing folder from path.  More... | |
| static QStringList | findFile (const QString &file, const QString &basepath=QString(), int maxClimbs=4, int searchCeiling=4, const QString ¤tDir=QString()) | 
| Will check basepath in an outward spiral up to maxClimbs levels to check if file exists.  More... | |
| static bool | pathIsSlowDevice (const QString &path) | 
| Returns trueif the specified path is assumed to reside on a slow device, e.g.  More... | |
| static QString | representFileSize (qint64 bytes) | 
| Returns the human size from bytes.  More... | |
| static QString | stringToSafeFilename (const QString &string) | 
| Converts a string to a safe filename, replacing characters which are not safe for filenames with an '_' character.  More... | |
| static QString | wildcardsFromFilter (const QString &filter) | 
| Given a filter string like "GeoTIFF Files (*.tiff *.tif)", extracts the wildcard portion of this filter (i.e.  More... | |
| 
 | static | 
Ensures that a fileName ends with an extension from the specified filter string.
E.g. a fileName of "d:/my_file" with a filter of "GeoTIFF Files (*.tiff *.tif)" will return "d:/my_file.tif", where as fileName of "d:/my_file.TIFF" or "d:/my_file.TIF" will be returned unchanged.
Definition at line 128 of file qgsfileutils.cpp.
| 
 | static | 
Returns the drive type for the given path.
| QgsNotSupportedException | if determining the drive type is not supported on the current platform. | 
Definition at line 285 of file qgsfileutils.cpp.
| 
 | static | 
Ensures that a fileName ends with an extension from the provided list of extensions.
E.g. if extensions contains "tif" and "tiff", then a fileName of "d:/my_file" will return "d:/my_file.tif". A fileName of "d:/my_file.TIFF" or "d:/my_file.TIF" will be returned unchanged.
Definition at line 101 of file qgsfileutils.cpp.
| 
 | static | 
Returns a list of the extensions contained within a file filter string.
E.g. a filter of "GeoTIFF Files (*.tiff *.tif)" would return a list containing "tiff", "tif". The initial '.' is stripped off the extension.
Definition at line 48 of file qgsfileutils.cpp.
| 
 | static | 
Returns true if the given fileName matches a file filter string. 
E.g a filter of "GeoTIFF Files (*.tiff *.tif)" would return true for a fileName of "/home/test.tif", or false for "/home/test.jpg".
Definition at line 77 of file qgsfileutils.cpp.
| 
 | static | 
Returns the top-most existing folder from path.
E.g. if path is "/home/user/projects/2018/P4343" and "/home/user/projects" exists but no "2018" subfolder exists, then the function will return "/home/user/projects".
Definition at line 142 of file qgsfileutils.cpp.
| 
 | static | 
Will check basepath in an outward spiral up to maxClimbs levels to check if file exists.
| file | Name or full path of the file to find | 
| basepath | current basepath of the file, needed if only the name is specified in file | 
| maxClimbs | limit the number of time the search can move up from the basepath | 
| searchCeiling | limits where in the folder hierarchy the search can be performed, 1 = root/drive, 2 = first folder level, 3 = sub folders ( Unix: /usr/bin, Win: C:/Users/Admin ), etc. | 
| currentDir | alternative default directory to override the actual current directory during the search | 
Definition at line 175 of file qgsfileutils.cpp.
| 
 | static | 
Returns true if the specified path is assumed to reside on a slow device, e.g. 
a remote network drive or other non-fixed device.
Definition at line 339 of file qgsfileutils.cpp.
| 
 | static | 
Returns the human size from bytes.
Definition at line 32 of file qgsfileutils.cpp.
| 
 | static | 
Converts a string to a safe filename, replacing characters which are not safe for filenames with an '_' character.
Definition at line 134 of file qgsfileutils.cpp.
| 
 | static | 
Given a filter string like "GeoTIFF Files (*.tiff *.tif)", extracts the wildcard portion of this filter (i.e.
"*.tiff *.tif").
Definition at line 67 of file qgsfileutils.cpp.