2 * This file defines functions to look up file paths.
4 * Copyright (C) 2009 David Kolossa
6 * This file is part of OpenStranded.
8 * OpenStranded is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * OpenStranded is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with OpenStranded. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef STRANDED_FILESYSTEM_HH
23 #define STRANDED_FILESYSTEM_HH
32 DirectoryInfo(std::string path
);
40 FileInfo(std::string path
, int error
);
49 static std::string modName
;
56 setModName(std::string name
);
62 getUserDirectoryInfo();
65 getGameDirectoryInfo();
68 getModDirectoryInfo();
76 getSaveFileInfo(std::string name
);
82 getTextureFileInfo(std::string name
);
85 getModelFileInfo(std::string name
);
88 getIconFileInfo(std::string name
);
91 getSpriteFileInfo(std::string name
);
94 getSkyFileInfo(std::string name
);
102 getSpeechFileInfo(std::string name
);
105 getEffectFileInfo(std::string name
);
109 * Return a vector with all files in a directory.
110 * The returned pointer to the vector needs to be freed by the
112 * @param dirPath The path of the directory
113 * @return A vector with the files of the filesystem without
116 static std::vector
<std::string
> *
117 getDirectoryVector(std::string dirPath
);
120 * Check whether a filename string with a name and an extension
121 * exists in a vector of const char*.
122 * This method is case-insensitive on Windows and case-sensitive
123 * in all other cases. The vector for the extensions also
124 * defines a priority on which element is returned. The element
125 * with the smaller index is returned when it comes to
127 * @param dirVector A pointer to a vector as returned by
128 * getDirectoryVector()
129 * @param extensions A vector with the extensions ordered by
131 * @param name The name of the file which is searched
132 * @return The matching string, "" if there is none.
135 getFileNameFromDirectoryVector(std::vector
<std::string
> *dirVector
, const std::vector
<std::string
> &extensions
, std::string name
);
138 #endif /* STRANDED_FILESYSTEM_HH */