Subversion Repositories Kolibri OS

Rev

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

Rev 5646 Rev 5648
Line 147... Line 147...
147
	$int 0x40
147
	$int 0x40
148
}
148
}
149
:struct __DIR
149
:struct __DIR
150
{
150
{
151
	int make(dword name);
151
	int make(dword name);
-
 
152
	dword load(...);
152
	dword position(dword i);
153
	dword position(dword i);
153
	dword buffer;
154
	dword buffer;
154
	signed count;
155
	signed count;
155
};
156
};
156
:dword __DIR::position(dword i)
157
:dword __DIR::position(dword i)
Line 169... Line 170...
169
	$mov eax,70
170
	$mov eax,70
170
	$mov ebx,#__file_F70.func
171
	$mov ebx,#__file_F70.func
171
	$int 0x40
172
	$int 0x40
172
}
173
}
Line -... Line 174...
-
 
174
 
-
 
175
:dword __DIR::load(dword PATH;byte options)
-
 
176
{
-
 
177
	io.count(PATH);
-
 
178
	if(count!=-1)
-
 
179
	{      
-
 
180
		buffer = malloc(count+1*304+32);
-
 
181
		___ReadDir(count, buffer, PATH);
-
 
182
		if (options == DIR_ONLYREAL)
-
 
183
		{
-
 
184
			if (!strcmp(".",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
-
 
185
			if (!strcmp("..",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
-
 
186
			return buffer;
-
 
187
		}
-
 
188
		if (options == DIR_NOROOT)
-
 
189
		{
-
 
190
			if (!strcmp(".",buffer+72)) memmov(buffer,buffer+304,count*304-304);
-
 
191
			return buffer;
-
 
192
		}
-
 
193
		return buffer;
-
 
194
	}
-
 
195
	return NULL;
-
 
196
}
173
 
197
 
174
:struct __PATH
198
:struct __PATH
175
{
199
{
176
	dword file(...);
200
	dword file(...);
177
	dword path(...);
201
	dword path(...);
Line 178... Line 202...
178
};
202
};
179
 
203
 
180
:char __PATH_NEW[4096];
204
:char __PATH_NEW[4096];
-
 
205
:dword __PATH::path(dword PATH)
-
 
206
{
181
:dword __PATH::path(dword PATH)
207
	dword pos;
182
{
208
	if(!PATH) return self.dir;
183
	dword pos = PATH;
209
	pos = PATH;
184
	if(DSBYTE[pos]=='/')
210
	if(DSBYTE[pos]=='/')
185
	{
211
	{
186
		pos++;
212
		pos++;
Line 194... Line 220...
194
		if(!strncmp(pos,"usbhd/",6)) return PATH;
220
		if(!strncmp(pos,"usbhd/",6)) return PATH;
195
		sprintf(#__PATH_NEW,"/sys%s",PATH);
221
		sprintf(#__PATH_NEW,"/sys%s",PATH);
196
		return #__PATH_NEW;
222
		return #__PATH_NEW;
197
	}
223
	}
198
	if(!strncmp(PATH,"./",2)) return PATH;
224
	if(!strncmp(PATH,"./",2)) return PATH;
199
	sprintf(#__PATH_NEW,"%s/%s",__DIR__,PATH);
225
	sprintf(#__PATH_NEW,"%s/%s",self.dir,PATH);
200
	return #__PATH_NEW;
226
	return #__PATH_NEW;
201
}
227
}
Line 202... Line 228...
202
 
228
 
203
:dword __PATH::file(dword name)
229
:dword __PATH::file(dword name)
Line 220... Line 246...
220
	signed FILES_SIZE;
246
	signed FILES_SIZE;
221
	dword file_name;
247
	dword file_name;
222
	double size(...);
248
	double size(...);
223
	dword get_size_dir(dword name);
249
	dword get_size_dir(dword name);
224
	signed count(dword path);
250
	signed count(dword path);
225
	dword dir_buffer(dword path;byte options);
-
 
226
	signed int run(dword path,param);
251
	signed int run(dword path,param);
227
	byte del(...);
252
	byte del(...);
228
	dword read(...);
253
	dword read(...);
229
	int write(...);
254
	int write(...);
230
	byte copy(...);
255
	byte copy(...);
Line 288... Line 313...
288
		return dir.count;
313
		return dir.count;
289
	}
314
	}
290
	return -1;
315
	return -1;
291
}
316
}
Line 292... Line -...
292
 
-
 
293
:dword IO::dir_buffer(dword PATH;byte options)
-
 
294
{
-
 
295
	count(PATH);
-
 
296
	if(dir.count!=-1)
-
 
297
	{
-
 
298
		//if(dir.buffer) dir.buffer = realloc(dir.buffer,dir.count+1*304+32);
-
 
299
		//else          
-
 
300
		dir.buffer = malloc(dir.count+1*304+32);
-
 
301
		___ReadDir(dir.count, dir.buffer, PATH);
-
 
302
		if (options == DIR_ONLYREAL)
-
 
303
		{
-
 
304
			if (!strcmp(".",dir.buffer+72)){dir.count--; memmov(dir.buffer,dir.buffer+304,dir.count*304);}
-
 
305
			if (!strcmp("..",dir.buffer+72)){dir.count--; memmov(dir.buffer,dir.buffer+304,dir.count*304);}
-
 
306
			return dir.buffer;
-
 
307
		}
-
 
308
		if (options == DIR_NOROOT)
-
 
309
		{
-
 
310
			if (!strcmp(".",dir.buffer+72)) memmov(dir.buffer,dir.buffer+304,dir.count*304-304);
-
 
311
			return dir.buffer;
-
 
312
		}
-
 
313
		return dir.buffer;
-
 
314
	}
-
 
315
	return NULL;
-
 
316
}
-
 
317
 
317
 
318
:double IO::size(dword PATH)
318
:double IO::size(dword PATH)
319
{
319
{
320
	dword i,tmp_buf,count_dir,count_file;
320
	dword i,tmp_buf,count_dir,count_file;
321
	dword filename;
321
	dword filename;
322
	double size_tmp;
322
	double size_tmp;
323
	double tmp;
323
	double tmp;
324
	if(!PATH)return 0;
324
	if(!PATH)return 0;
325
	if(___GetFileInfo(PATH, #BDVK))return -1;
325
	if(___GetFileInfo(PATH, #BDVK))return -1;
326
	if(BDVK.isfolder)
326
	if(BDVK.isfolder)
327
	{
327
	{
328
		tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
328
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
329
		if(dir.count<1)return 0;
329
		if(dir.count<1)return 0;
330
		count_dir = dir.count;
330
		count_dir = dir.count;
331
		i = 0;
331
		i = 0;
332
		size_tmp = 0;
332
		size_tmp = 0;
Line 357... Line 357...
357
	dword i,tmp_buf,count_dir,count_file;
357
	dword i,tmp_buf,count_dir,count_file;
358
	if(!PATH)return 0;
358
	if(!PATH)return 0;
359
	if(___GetFileInfo(PATH, #BDVK))return false;
359
	if(___GetFileInfo(PATH, #BDVK))return false;
360
	if(BDVK.isfolder)
360
	if(BDVK.isfolder)
361
	{
361
	{
362
		tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
362
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
363
		count_dir = dir.count;
363
		count_dir = dir.count;
364
		i = 0;
364
		i = 0;
365
		count_file = malloc(4096);
365
		count_file = malloc(4096);
366
		while(i
366
		while(i
367
		{
367
		{
Line 386... Line 386...
386
	cmd_hide   = atr&11b;
386
	cmd_hide   = atr&11b;
387
	atr>>=2;
387
	atr>>=2;
388
	cmd_system = atr&11b;
388
	cmd_system = atr&11b;
389
	if(BDVK.isfolder)
389
	if(BDVK.isfolder)
390
	{
390
	{
391
		tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
391
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
392
		count_dir = dir.count;
392
		count_dir = dir.count;
393
		i = 0;
393
		i = 0;
394
		count_file = malloc(4096);
394
		count_file = malloc(4096);
395
		while(i
395
		while(i
396
		{
396
		{
Line 429... Line 429...
429
	_path_ = malloc(4096);
429
	_path_ = malloc(4096);
430
	if(BDVK.isfolder)
430
	if(BDVK.isfolder)
431
	{
431
	{
432
		sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
432
		sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
433
		dir.make(_path_);
433
		dir.make(_path_);
434
		tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
434
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
435
		count_dir = dir.count;
435
		count_dir = dir.count;
436
		i = 0;
436
		i = 0;
437
		count_file = malloc(4096);
437
		count_file = malloc(4096);
438
		while(i
438
		while(i
439
		{
439
		{