Eolite 1.65: dynamic memory allocation for Eolite.ini

Installer: serious bug fixed
some optimizations

git-svn-id: svn://kolibrios.org@3432 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-03-30 00:52:50 +00:00
parent f8ff581ce7
commit 7506d07dd9
10 changed files with 53 additions and 106 deletions

View File

@ -1,4 +1,4 @@
..\C--\c-- HTMLv.c /lst
..\C--\c-- HTMLv.c
@del HTMLv
@rename HTMLv.com HTMLv
@del warning.txt

View File

@ -1,7 +1,7 @@
set BINDIR=C:\Users\111\Desktop\svn\programs\cmm\_bin
set BINDIR=C:\Users\Кирилл\Desktop\cmm\_bin
md %BINDIR%
cd %BINDIR%
FOR %%A in (*.*) do del \Q "%%A"
rem FOR %%A in (*.*) do del \Q "%%A"
cd ..\browser
cls

View File

@ -26,8 +26,8 @@ int BUTTON_HEIGHT=18;
#define ONLY_OPEN 2
//ïåðåìåííûå
#define TITLE "Eolite File Manager v1.64"
#define ABOUT_TITLE "Eolite v1.64"
#define TITLE "Eolite File Manager v1.65"
#define ABOUT_TITLE "Eolite v1.65"
dword col_work = 0xE4DFE1;
dword col_border = 0x819FC5;
dword col_padding = 0xC8C9C9;
@ -62,7 +62,7 @@ char Item[4096];
};
int toolbar_buttons_x[7]={9,46,85,134,167,203};
char tmp_disk_del_param[3]="d0\0";
char tmp_disk_del_param[3]="d0";
dword file_mas[6898];
int j, i, mouse_dd;
@ -102,19 +102,17 @@ void main()
mem_Init();
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj");
SetEventMask(0x27);
GetSystemDiscs();
GetIni(1);
GetIni(1);
if (param)
{
strcpy(#path, #param);
if (strcmp(#path+strlen(#path)-1,"/")<>0) strcat(#path, "/"); //åñëè íåò, + "/"
}
else
strcpy(#path, "/rd/1/");
strcpy(#path, "/rd/1/");
Open_Dir(#path,ONLY_OPEN);
SetEventMask(0x27);
loop() switch(WaitEvent())
{
case evMouse:

View File

@ -14,7 +14,7 @@ void about_dialog()
id=GetButtonID();
IF (id==1) || (id==10) ExitProcess();
IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK);
IF (id==33) RunProgram(EDITOR_PATH, #program_path);
IF (id==33) RunProgram(EDITOR_PATH, abspath("Eolite.ini"));
break;
case evKey:

View File

@ -15,7 +15,7 @@ unsigned char *ERROR_TEXT[]={
"Error #5 - File or folder not found",
"Error #6 - End of file, EOF",
"Error #7 - Pointer lies outside of application memory",
"Error #8 - FAT table is destroyed",
"Error #8 - Too less disk space",
"Error #9 - FAT table is destroyed",
"Error #10 - Access denied",
"Error #11 - Device error",
@ -36,13 +36,7 @@ void GetIni(byte onload)
if (onload==1)
{
free(buff);
buff = malloc(12000);
program_path[strrchr(#program_path, '/')] = NULL;
strcat(#program_path, "Eolite.ini");
ReadFile(0, 12000, buff, #program_path);
fsize=EBX;
IF (EAX<>6) ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini");
IF (EAX<>6) notify("Eolite.ini not found. Defaults will be used.");
if (!GetFile(#buff, #fsize, abspath("Eolite.ini"))) notify("Eolite.ini not found. Defaults will be used.");
}
//ïàðñèì åãî
for (tj=0; tj<fsize; tj++;)
@ -119,16 +113,16 @@ void Write_Error(int error_number)
dword StrToCol(char* htmlcolor)
{
dword j, color=0;
char ch=0x00;
FOR (j=0; j<6; j++)
{
ch=ESBYTE[htmlcolor+j];
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
color = color*0x10 + ch;
}
return color;
dword color;
char j, ch;
FOR (j=0; j<6; j++)
{
ch=ESBYTE[htmlcolor+j];
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
color = color*0x10 + ch;
}
return color;
}

View File

@ -7,26 +7,20 @@ You can find more information here:
http://board.kolibrios.org/viewtopic.php?f=9&t=973
==Install==
Put box_lib.obj into "/sys/lib/" directory.
Put Eolite.ini into programs directory or in "/sys/File Managers/".
Eolite can be opened from anywhere.
==Authors==
Leency - programming and design.
Veliant - programming and support. Inactive now.
lev
<Lrz>
Nable
==Thanks==
diamond
<Lrz>
Nable
Mario79
Rock_maniak_forever
turbanoff
Sorcerer
SoUrcerer
Gluk
lev
KolibriOS Forever!

View File

@ -11,21 +11,22 @@ http://board.kolibrios.org/viewtopic.php?f=9&t=973
==Установка==
Нужно иметь свежий box_lib.obj. Eolite.ini должен быть в папке
с программой или в "/sys/File Managers/".
с программой.
==Авторы==
Leency - разработка, дизайн.
Veliant - программирование, поддержка.
<Lrz> - компонент EditBox и либу к нему.
lev - алгоритм работы с массивами строк.
Nable - некоторые оптимизации и поддержка.
==Спасибо==
diamond - активная помощь в программировании, ценные советы.
<Lrz> - за компонент EditBox и либу к нему.
Nable - за некоторые оптимизации и поддержку, либу работы с IPC.
Mario79 - советы.
S1n - за реализацию работы с lib_ini (увы не используемую).
Rock_maniak_forever, turbanoff, Sorcerer, Gluk, Albom - за найденые баги.
lev - за алгоритм работы с массивами строк.
У нас будет свой Менует с блекджеком! И шлюхами! KolibriOS Forever!

View File

@ -2,18 +2,18 @@
// относительный путь относительно программы
void copyf(dword params)
{
//copyf /sys/lib|/sys/lib2
{
//copyf: /sys/lib|/sys/lib2
char from[4096], to[4096];
BDVK from_atr;
int border;
mem_Init();
if (!params) { notify("Error: no copyf params!"); return; }
program_path[strrchr(#program_path, '/')] = 0x0;
//ищем разделитель
border = strchr(params, '|');
if (!border) border = strchr(params, ' ');
if (ESBYTE[params]<>'/')
if (ESBYTE[params]<>'/') //абсолютный путь?
{
strcpy(#from, #program_path);
strcat(#from, params);
@ -28,13 +28,9 @@ void copyf(dword params)
GetFileInfo(#from, #from_atr);
if (TestBit(from_atr.attr, 4)==1)
{
CopyFolder(#from, #to);
}
else
{
else
CopyFile(#from, #to);
}
}
@ -46,7 +42,7 @@ void CopyFolder(dword from, to)
char from2[4096], to2[4096];
error = GetDir(#dirbuf, #fcount, from);
if (error) debug_error(from, error);
if (error) { debug_error(from, error); return; }
if ((strcmp(to, "/sys")!=0) && (strcmp(to, "/tmp9/1")!=0))
{
@ -102,7 +98,7 @@ unsigned char *ERROR_TEXT[]={
"Error #5 - File or folder not found",
"Error #6 - End of file, EOF",
"Error #7 - Pointer lies outside of application memory",
"Error #8 - Too less disk space or FAT table is destroyed",
"Error #8 - Too less disk space",
"Error #9 - FAT table is destroyed",
"Error #10 - Access denied",
"Error #11 - Device error",
@ -129,45 +125,3 @@ void debug_error(int path, error_number)
}
debug(#error);
}
/*
int files_num;
void CalculateFilesNumber(dword from)
{
dword dirbuf, fcount, filename;
int i, isdir, error;
char from2[4096];
error = GetDir(#dirbuf, #fcount, from);
if (error) debug_error(from, error);
debugi(fcount);
for (i=0; i<fcount; i++)
{
filename = i*304+dirbuf+72;
isdir = TestBit(ESDWORD[filename-40], 4);
if (!isdir)
{
files_num++;
debug(filename);
}
else
{
if ( (!strcmp(filename, ".")) || (!strcmp(filename, "..")) ) continue;
strcpy(#from2, from);
chrcat(#from2, '/');
strcat(#from2, filename);
CalculateFilesNumber(#from2);
}
}
free(dirbuf);
}
int GetFilesNumber(dword pathz)
{
files_num = 0;
CalculateFilesNumber(pathz);
return files_num;
}
*/

View File

@ -55,9 +55,7 @@ int DefineWindow(dword wtitle, wbutton)
void main()
{
mem_Init();
//if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj");
//SetEventMask(0x27);
program_path[strrchr(#program_path, '/')] = 0x0;
program_path[strrchr(#program_path, '/')] = '\0';
HalloLoop();
}

View File

@ -99,7 +99,7 @@ f70 read_file_70;
:int GetFile(dword buf, filesize, read_path)
{
BDVK ReadFile_atr;
dword rBuf=0;
dword rBuf;
if (! GetFileInfo(read_path, #ReadFile_atr))
{
rBuf = malloc(ReadFile_atr.sizelo);
@ -114,6 +114,7 @@ f70 read_file_70;
return 0;
}
////////////////////////////
// Çàïèñàòü ôàéë //
////////////////////////////
@ -203,11 +204,9 @@ f70 getinfo_file_70;
if (! ReadFile(0, CopyFile_atr.sizelo, cBufer, copy_from))
{
rezult = WriteFile(CopyFile_atr.sizelo, cBufer, copy_in);
debugi(rezult);
}
}
free(cBufer);
debugi(rezult);
return rezult;
}
@ -229,3 +228,12 @@ void notify(dword notify_param)
{
RunProgram("@notify", notify_param);
}
:dword abspath(dword relative_path) //GetAbsolutePathFromRelative()
{
char absolute_path[4096];
strcpy(#absolute_path, #program_path);
absolute_path[strrchr(#absolute_path, '/')] = '\0';
strcat(#absolute_path, relative_path);
return #absolute_path;
}