mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 18:07:09 +01:00
utils: mdldec: fix build on Windows, use GetFileAttributes instead of stat here
This commit is contained in:
parent
cbcb90638b
commit
d562642e26
@ -17,6 +17,7 @@ GNU General Public License for more details.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "xash3d_types.h"
|
#include "xash3d_types.h"
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
#include "crtlib.h"
|
#include "crtlib.h"
|
||||||
@ -29,12 +30,26 @@ MakeDirectory
|
|||||||
*/
|
*/
|
||||||
qboolean MakeDirectory( const char *path )
|
qboolean MakeDirectory( const char *path )
|
||||||
{
|
{
|
||||||
struct stat st;
|
if( -1 == _mkdir( path ))
|
||||||
|
{
|
||||||
|
if( errno == EEXIST )
|
||||||
|
{
|
||||||
|
// TODO: when filesystem library will be ready
|
||||||
|
// use FS_SysFolderExists here or replace this whole function
|
||||||
|
// with FS_CreatePath
|
||||||
|
#if XASH_WIN32
|
||||||
|
DWORD dwFlags = GetFileAttributes( path );
|
||||||
|
|
||||||
if( -1 == _mkdir( path )
|
return ( dwFlags != -1 ) && ( dwFlags & FILE_ATTRIBUTE_DIRECTORY );
|
||||||
&& ( -1 == stat( path, &st )
|
#else
|
||||||
|| !S_ISDIR(st.st_mode ) ) )
|
struct stat buf;
|
||||||
|
|
||||||
|
if( !stat( path, &buf ))
|
||||||
|
return S_ISDIR( buf.st_mode );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user