Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://astro.uni-altai.ru/~aw/stellarium/api/classStelFileMgr.html
Дата изменения: Unknown Дата индексирования: Fri Feb 28 07:25:40 2014 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п п п п п |
![]() |
Stellarium 0.12.3
|
Provides utilities for locating and handling files. More...
#include <StelFileMgr.hpp>
Public Types | |
enum | Flags { RemovableMedia = 0x00000001, Writable = 0x00000002, Directory = 0x00000004, File = 0x00000008, New = 0x00000010, Hidden = 0x00000020 } |
used as named bitfield flags as specifiers to filter results of StelFileMgr methods. More... | |
Static Public Member Functions | |
static void | init () |
Initialize the directories. More... | |
static QString | findFile (const QString &path, const Flags &flags=(Flags) 0) |
Search for a path within the search paths, for example "textures/fog.png". More... | |
static QStringList | findFileInAllPaths (const QString &path, const Flags &flags=(Flags) 0) |
List all paths witihin the search paths that match the argument. More... | |
static QSet< QString > | listContents (const QString &path, const Flags &flags=(Flags) 0, bool recursive=false) |
Set a set of all possible files/directories in any Stellarium search directory. More... | |
static const QStringList & | getSearchPaths (void) |
Get a vector of strings which describes the current search paths. More... | |
static void | setSearchPaths (const QStringList &paths) |
Set the search paths. More... | |
static void | makeSureDirExistsAndIsWritable (const QString &dirFullPath) |
Make sure the passed directory path exist and is writable. More... | |
static bool | exists (const QString &path) |
Check if a path exists. More... | |
static bool | isAbsolute (const QString &path) |
Check if a path is absolute. More... | |
static bool | isReadable (const QString &path) |
Check if a path is readable. More... | |
static bool | isWritable (const QString &path) |
Check if a path is writable For files, true is returned if the file exists and is writable or if the file doesn't exist, but it's parent directory does, if the file can be created. More... | |
static bool | isDirectory (const QString &path) |
Check if a path exists and is a directory. More... | |
static qint64 | size (const QString &path) |
Return the size of the file at the path. More... | |
static bool | mkDir (const QString &path) |
Make a directory. More... | |
static QString | dirName (const QString &path) |
Convenience function to find the parent directory of a given path May return relative paths if the parameter is a relative path. More... | |
static QString | baseName (const QString &path) |
Convenience function to find the basename of a given path May return relative paths if the parameter is a relative path. More... | |
static QString | getDesktopDir () |
Get the user's Desktop directory. More... | |
static QString | getUserDir () |
Returns the path to the user directory. More... | |
static QString | getInstallationDir () |
Returns the path to the installation directory This is the directory where we expect to find scripts, nebulae, stars, skycultures etc, and will be added at the end of the search path. More... | |
static QString | getCacheDir () |
Returns the path to the cache directory. Note that subdirectories may need to be created for specific caches. More... | |
static void | setUserDir (const QString &newDir) |
Sets the user directory. More... | |
static QString | getScreenshotDir () |
This is the directory into which screenshots will be saved. More... | |
static void | setScreenshotDir (const QString &newDir) |
Sets the screenshot directory. More... | |
static QString | getLocaleDir () |
get the directory for locate files (i18n) More... | |
Provides utilities for locating and handling files.
StelFileMgr provides functions for locating files. It maintains a list of directories in which to look for files called the search path. Typcially this includes the Stellarium installation directory, and a per-user settings directory (on platforms which support it). The concept is that the StelFileMgr will be asked for a named path, and it will try to locate that path within each of the search directories.
Definition at line 40 of file StelFileMgr.hpp.
enum StelFileMgr::Flags |
used as named bitfield flags as specifiers to filter results of StelFileMgr methods.
Definition at line 44 of file StelFileMgr.hpp.
|
static |
Convenience function to find the basename of a given path May return relative paths if the parameter is a relative path.
path | the path whose parent directory is to be returned |
|
static |
Convenience function to find the parent directory of a given path May return relative paths if the parameter is a relative path.
path | the path whose parent directory is to be returned |
|
static |
Check if a path exists.
Note it might be a file or a directory.
path | to check |
|
static |
Search for a path within the search paths, for example "textures/fog.png".
findFile looks through the search paths in order, returning the first instance of the specified path. By specifying a flags parameter it is possible to constrain the results to those matching various criteria. If the path argument is a complete path (is a full path on single root OSes, or unanbigiously identifies one and only one file on multi-root OSes), it will be tested for compliance with other conditions - the regular search path will not be tested. If you wish to search for a non-exiting file which is not in the search path you should explicitly prefix it with "./", or otherwise have a . at the start of the path parameter, e.g. path="./my_config_file_in_the_pwd.ini"
path | the name of the file to search for, for example "textures/fog.png". |
flags | options which constrain the result. |
std::runtime_error | what() -> "file not found: [filename]" |
std::runtime_error | what() -> "file does not match flags: [fullpath]". This exception occurs if a full path is passes at the path argument, but that path does not match the flags specified. |
|