tibia-client/src/framework/core/resources.h

47 lines
1.4 KiB
C
Raw Normal View History

2011-04-06 21:46:58 +02:00
#ifndef RESOURCES_H
#define RESOURCES_H
2011-07-13 23:12:36 +02:00
#include <global.h>
#include <stack>
2011-04-06 21:46:58 +02:00
class Resources
{
public:
2011-04-06 21:46:58 +02:00
Resources() { }
void init(const char *argv0);
void terminate();
2011-05-19 19:11:05 +02:00
/// Set output files dir
bool setWriteDir(const std::string &path);
2011-05-19 19:11:05 +02:00
/// Add an package or directory to the search path
bool addToSearchPath(const std::string& path, bool insertInFront = true);
2011-05-19 19:11:05 +02:00
/// Add all packages from a directory
void addPackagesToSearchPath(const std::string &packagesDirectory, const std::string &packageExtension, bool append);
2011-05-19 19:11:05 +02:00
bool fileExists(const std::string& fileName);
bool directoryExists(const std::string& directoryName);
2011-05-19 19:11:05 +02:00
bool loadFile(const std::string& fileName, std::iostream& out);
2011-05-19 19:11:05 +02:00
bool saveFile(const std::string& fileName, const uchar *data, uint size);
2011-05-22 05:56:58 +02:00
bool saveFile(const std::string& fileName, const std::string& data) { return saveFile(fileName, (const uchar*)data.c_str(), data.size()); }
2011-05-19 19:11:05 +02:00
bool saveFile(const std::string& fileName, std::istream& in);
2011-05-19 19:11:05 +02:00
bool deleteFile(const std::string& fileName);
2011-05-19 19:11:05 +02:00
std::list<std::string> listDirectoryFiles(const std::string& directoryPath = "");
2011-05-19 19:11:05 +02:00
void pushCurrentPath(const std::string &currentPath);
void popCurrentPath();
std::string resolvePath(const std::string& path);
2011-03-26 21:53:08 +01:00
2011-05-19 19:11:05 +02:00
private:
std::stack<std::string> m_currentPaths;
};
2011-04-06 21:46:58 +02:00
extern Resources g_resources;
2011-04-06 21:46:58 +02:00
#endif // RESOURCES_H