17 #if _RAKNET_SUPPORT_FileOperations==1
43 char pathCopy[MAX_PATH];
46 if ( path == 0 || path[ 0 ] == 0 )
49 strcpy_s( pathCopy, path );
55 while ( pathCopy[ index ] )
57 if ( pathCopy[ index ] ==
'/' || pathCopy[ index ] ==
'\\')
59 pathCopy[ index ] = 0;
62 res = _mkdir( pathCopy );
65 res = mkdir( pathCopy, 0744 );
67 if (res<0 && errno!=EEXIST && errno!=EACCES)
72 pathCopy[ index ] =
'/';
81 if ( fopen_s( &fp, path,
"wb" ) != 0 )
86 fwrite( data, 1, dataLength, fp );
93 res = _mkdir( pathCopy );
95 res = mkdir( pathCopy, 0744 );
98 if (res<0 && errno!=EEXIST)
108 return c==
'/' || c==
'\\';
113 if (input==0 || input[0]==0)
116 int lastCharIndex=(int) strlen(input)-1;
117 if (input[lastCharIndex]==
'\\')
118 input[lastCharIndex]=
'/';
119 else if (input[lastCharIndex]!=
'/')
121 input[lastCharIndex+1]=
'/';
122 input[lastCharIndex+2]=0;
127 _finddata_t fileInfo;
129 char baseDirWithStars[560];
130 strcpy_s(baseDirWithStars, directory);
132 strcat_s(baseDirWithStars,
"*.*");
133 dir=_findfirst(baseDirWithStars, &fileInfo );
143 for (i=0; str[i]; i++)
153 int len=(int)strlen(str);
154 memmove(str+1, str, len);
163 if (fopen_s(&fp, path,
"rb")!=0)
return 0;
164 fseek(fp, 0, SEEK_END);
165 unsigned int fileLength = ftell(fp);
171 #endif // _RAKNET_SUPPORT_FileOperations