mirror of https://github.com/axmolengine/axmol.git
added winrt and wp8 platforms. Cleaned up platform checks
This commit is contained in:
parent
0cfe930078
commit
cca5d90cbe
|
@ -450,7 +450,17 @@ bool AssetsManager::uncompress()
|
||||||
*/
|
*/
|
||||||
bool AssetsManager::createDirectory(const char *path)
|
bool AssetsManager::createDirectory(const char *path)
|
||||||
{
|
{
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||||
|
#pragma message("warning: AssetsManager::createDirectory() not implemented for CC_PLATFORM_WINRT//WP8 " __FILE__ " : " __FUNCTION__)
|
||||||
|
return false;
|
||||||
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
|
BOOL ret = CreateDirectoryA(path, nullptr);
|
||||||
|
if (!ret && ERROR_ALREADY_EXISTS != GetLastError())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
mode_t processMask = umask(0);
|
mode_t processMask = umask(0);
|
||||||
int ret = mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO);
|
int ret = mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
umask(processMask);
|
umask(processMask);
|
||||||
|
@ -458,16 +468,11 @@ bool AssetsManager::createDirectory(const char *path)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
BOOL ret = CreateDirectoryA(path, nullptr);
|
|
||||||
if (!ret && ERROR_ALREADY_EXISTS != GetLastError())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetsManager::setSearchPath()
|
void AssetsManager::setSearchPath()
|
||||||
|
@ -638,19 +643,20 @@ AssetsManager* AssetsManager::create(const char* packageUrl, const char* version
|
||||||
void AssetsManager::createStoragePath()
|
void AssetsManager::createStoragePath()
|
||||||
{
|
{
|
||||||
// Remove downloaded files
|
// Remove downloaded files
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||||
|
#pragma message("warning: AssetsManager::createStoragePath() not implemented for CC_PLATFORM_WINRT/WP8 " __FILE__ " : " __FUNCTION__)
|
||||||
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
|
if ((GetFileAttributesA(_storagePath.c_str())) == INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
CreateDirectoryA(_storagePath.c_str(), 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
DIR *dir = nullptr;
|
DIR *dir = nullptr;
|
||||||
|
|
||||||
dir = opendir (_storagePath.c_str());
|
dir = opendir (_storagePath.c_str());
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
mkdir(_storagePath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
mkdir(_storagePath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if ((GetFileAttributesA(_storagePath.c_str())) == INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
|
||||||
CreateDirectoryA(_storagePath.c_str(), 0);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,16 +666,18 @@ void AssetsManager::destroyStoragePath()
|
||||||
deleteVersion();
|
deleteVersion();
|
||||||
|
|
||||||
// Remove downloaded files
|
// Remove downloaded files
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||||
string command = "rm -r ";
|
#pragma message("warning: AssetsManager::destroyStoragePath() not implemented for CC_PLATFORM_WINRT/WP8 " __FILE__ " : " __FUNCTION__)
|
||||||
// Path may include space.
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
command += "\"" + _storagePath + "\"";
|
|
||||||
system(command.c_str());
|
|
||||||
#else
|
|
||||||
string command = "rd /s /q ";
|
string command = "rd /s /q ";
|
||||||
// Path may include space.
|
// Path may include space.
|
||||||
command += "\"" + _storagePath + "\"";
|
command += "\"" + _storagePath + "\"";
|
||||||
system(command.c_str());
|
system(command.c_str());
|
||||||
|
#else
|
||||||
|
string command = "rm -r ";
|
||||||
|
// Path may include space.
|
||||||
|
command += "\"" + _storagePath + "\"";
|
||||||
|
system(command.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue