Created
February 14, 2018 22:49
-
-
Save larsiusprime/37b20a5113e2c626845d5c67299b8886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
sys_create_dir : string -> mode:int -> void | |
<doc>Create a directory with the specified rights</doc> | |
**/ | |
bool _hx_std_sys_create_dir( String path, int mode ) | |
{ | |
printf("_hx_std_sys_create_dir()\n"); | |
#ifdef EPPC | |
return true; | |
#else | |
hx::EnterGCFreeZone(); | |
#ifdef NEKO_WINDOWS | |
//bool err = mkdir(path.__s); | |
std::wstring temp = _Win32Utf8ToUtf16( path.__s ); | |
bool err = _wmkdir( temp.c_str() ); | |
#else | |
bool err = mkdir(path.__s,mode); | |
#endif | |
hx::ExitGCFreeZone(); | |
return !err; | |
#endif | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef NEKO_WINDOWS | |
// Do not use outside win32 | |
inline std::wstring _Win32Utf8ToUtf16(const std::string& str) | |
{ | |
printf("TESTING\n"); | |
std::wstring convertedString; | |
int requiredSize = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, 0, 0); | |
if( requiredSize > 0 ) | |
{ | |
convertedString.resize(requiredSize); | |
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, &convertedString[0], requiredSize); | |
convertedString.pop_back(); //remove NULL terminator | |
} | |
return convertedString; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 14 can be removed.
The printf calls too.
temp could have been const.
Otherwise, Looks Good To Me 👍