File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ struct TidyResult{
19
19
TidyBoolean error ;
20
20
};
21
21
typedef struct TidyResult TidyResult ;
22
+
22
23
TidyBoolean tidyFML_exists (const char tidyPath []){
23
24
#ifdef _WIN32
24
25
DWORD tidyAttributes = GetFileAttributes (tidyPath );
@@ -202,3 +203,32 @@ TidyBoolean tidyFML_clear(const char tidyPath[]){
202
203
}
203
204
return FALSE;
204
205
}
206
+
207
+ long tidyFML_fileSize (const char [] tidyPath ){
208
+ #ifdef WIN32
209
+ HANDLE hFile = CreateFile (
210
+ tidyPath ,
211
+ GENERIC_READ ,
212
+ FILE_SHARE_READ ,
213
+ NULL ,
214
+ OPEN_EXISTING ,
215
+ FILE_ATTRIBUTE_NORMAL ,
216
+ NULL
217
+ );
218
+ if (hFile == INVALID_HANDLE_FILE ){
219
+ return -1 ;
220
+ }
221
+ DWORD tidySize = GetFileSize (hFile , NULL );
222
+ CloseHandle (hFile );
223
+ if (tidySize == INVALID_FILE_SIZE ){
224
+ return -1 ;
225
+ }
226
+ else {
227
+ return (long )tidySize ;
228
+ }
229
+ #else
230
+ struct stat st ;
231
+ stat (tidyPath , & st );
232
+ return (long )st .st_size ;
233
+ #endif
234
+ }
You can’t perform that action at this time.
0 commit comments