2010-10-13 14:18:03 +08:00
|
|
|
#ifndef _FILE_UTILS_H_
|
|
|
|
#define _FILE_UTILS_H_
|
|
|
|
|
|
|
|
#include "TG3.h"
|
|
|
|
|
2010-12-15 18:28:18 +08:00
|
|
|
namespace CocosDenshion {
|
|
|
|
|
2010-11-12 16:33:50 +08:00
|
|
|
/**
|
|
|
|
@class FileUtils
|
|
|
|
@brief Offer tools of file system
|
|
|
|
*/
|
2010-10-13 14:18:03 +08:00
|
|
|
class FileUtils
|
|
|
|
{
|
|
|
|
public:
|
2010-11-12 16:33:50 +08:00
|
|
|
/**
|
|
|
|
@brief Whether the file is existed or not
|
|
|
|
@param pFilePath The absolute path of file.
|
|
|
|
@return If existed return true,or return false
|
|
|
|
*/
|
2010-12-11 11:08:03 +08:00
|
|
|
static bool isFileExisted(const char* pFilePath);
|
2010-10-13 14:18:03 +08:00
|
|
|
|
2010-12-11 11:08:03 +08:00
|
|
|
/**
|
|
|
|
@brief Set the ResourcePath,we will find resource in this path
|
|
|
|
@param pszResourcePath The absolute resource path
|
|
|
|
*/
|
|
|
|
static void setResourcePath(const char *pszResourcePath);
|
|
|
|
|
|
|
|
/**
|
|
|
|
@brief Set the absolute path of the .zip file which contains all resource files
|
|
|
|
@param pszZipPath The absolute path of the .zip file
|
|
|
|
*/
|
|
|
|
static void setResourceZipFile(const char* pszZipPath);
|
2010-10-13 14:18:03 +08:00
|
|
|
|
2010-12-11 11:08:03 +08:00
|
|
|
/**
|
|
|
|
@brief Get resource file data
|
|
|
|
@param[in] pszFileName The resource file name which contain the path
|
|
|
|
@param[in] pszMode The read mode of the file
|
|
|
|
@param[out] pSize If get the file data succeed the it will be the data size,or it will be 0
|
|
|
|
@return if success,the pointer of data will be returned,or NULL is returned
|
|
|
|
@warning If you get the file data succeed,you must delete it after used.
|
|
|
|
*/
|
|
|
|
static unsigned char* getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize);
|
2010-10-13 14:18:03 +08:00
|
|
|
};
|
|
|
|
|
2010-12-15 18:28:18 +08:00
|
|
|
} // end of namespace CocosDenshion
|
|
|
|
|
2010-10-13 14:18:03 +08:00
|
|
|
#endif
|