Subversion Repositories Kolibri OS

Rev

Rev 7639 | Rev 8383 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7639 Rev 7878
Line 4... Line 4...
4
 
4
 
5
#ifndef INCLUDE_DATE_H
5
#ifndef INCLUDE_DATE_H
6
#include "../lib/date.h"
6
#include "../lib/date.h"
Line -... Line 7...
-
 
7
#endif
-
 
8
 
-
 
9
#ifndef INCLUDE_COLLECTION_H
-
 
10
#include "../lib/collection.h"
7
#endif
11
#endif
8
 
12
 
9
//===================================================//
13
//===================================================//
10
//                                                   //
14
//                                                   //
11
//              Basic System Functions               //
15
//              Basic System Functions               //
Line 233... Line 237...
233
	DIRS_ALL,
237
	DIRS_ALL,
234
	DIRS_NOROOT,
238
	DIRS_NOROOT,
235
	DIRS_ONLYREAL
239
	DIRS_ONLYREAL
236
};
240
};
237
:int GetDir(dword dir_buf, file_count, path, doptions)
241
:int GetDir(dword dir_buf, file_count, path, doptions)
238
{
-
 
239
	dword buf, fcount, error;
242
dword buf, fcount, error;
240
	buf = malloc(32);
243
char readbuf[32];
-
 
244
{
241
	error = ReadDir(0, buf, path);
245
	error = ReadDir(0, #readbuf, path);
242
	if (!error)
246
	if (!error)
243
	{
247
	{
244
		fcount = ESDWORD[buf+8];
248
		fcount = ESDWORD[#readbuf+8];
245
		buf = realloc(buf, fcount+1*304+32);
249
		buf = malloc(fcount+1*304+32);
246
		ReadDir(fcount, buf, path);
250
		ReadDir(fcount, buf, path);
247
		//fcount=EBX;
251
		//fcount=EBX;
Line 248... Line 252...
248
 
252
 
249
		if (doptions == DIRS_ONLYREAL)
253
		if (doptions == DIRS_ONLYREAL)
Line 259... Line 263...
259
		ESDWORD[dir_buf] = buf;
263
		ESDWORD[dir_buf] = buf;
260
		ESDWORD[file_count] = fcount;
264
		ESDWORD[file_count] = fcount;
261
	}
265
	}
262
	else
266
	else
263
	{
267
	{
264
		ESDWORD[dir_buf] = free(buf);
268
		ESDWORD[dir_buf] = 0;
265
		ESDWORD[file_count] = 0;
269
		ESDWORD[file_count] = 0;
266
	}
270
	}
267
	return error;
271
	return error;
268
}
272
}
Line 419... Line 423...
419
//                                                   //
423
//                                                   //
420
//                  Directory Size                   //
424
//                  Directory Size                   //
421
//                                                   //
425
//                                                   //
422
//===================================================//
426
//===================================================//
Line 423... Line 427...
423
 
427
 
424
:struct _dir_size
428
:struct DIR_SIZE
425
{
429
{
426
	BDVK dir_info;
430
	BDVK dir_info;
427
	dword folders;
431
	dword folders;
428
	dword files;
432
	dword files;
429
	dword bytes;
433
	dword bytes;
430
	void get();	
434
	dword get();	
431
	void calculate_loop();	
435
	dword calculate_loop();	
Line 432... Line 436...
432
} dir_size;
436
};
433
 
437
 
434
:void _dir_size::get(dword way)
438
:dword DIR_SIZE::get(dword way1)
-
 
439
{
435
{
440
	folders = files = bytes = 0;
436
	folders = files = bytes = 0;
441
	if (!way1) return 0;
Line 437... Line 442...
437
	if (way) calculate_loop(way);
442
	calculate_loop(way1);
438
}
443
}
439
 
444
 
440
:void _dir_size::calculate_loop(dword way)
445
:dword DIR_SIZE::calculate_loop(dword way)
-
 
446
{
441
{
447
	dword dirbuf, fcount, i, filename;
442
	dword dirbuf, fcount, i, filename;
448
	dword cur_file;
443
	dword cur_file;
449
	if (!way) return 0;
444
	if (dir_exists(way))
450
	if (dir_exists(way))
445
	{
451
	{
Line 465... Line 471...
465
			}
471
			}
466
		}
472
		}
467
		free(cur_file);
473
		free(cur_file);
468
		free(dirbuf);
474
		free(dirbuf);
469
	}
475
	}
-
 
476
	return files;
470
}
477
}
Line -... Line 478...
-
 
478
 
471
 
479
 
472
#endif
480
#endif