Eolite 3.68: do not hold slash in the end of the #path

git-svn-id: svn://kolibrios.org@6635 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-10-30 19:17:46 +00:00
parent 1c171f35ce
commit 4d00613e3b
7 changed files with 24 additions and 36 deletions

View File

@ -152,7 +152,7 @@ void main()
if (param)
{
strcpy(#path, #param);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
if (path[strlen(#path)-1]=='/') path[strlen(#path)-1]=NULL; //no "/" in the end
}
Open_Dir(#path,ONLY_OPEN);
@ -707,7 +707,8 @@ void Line_ReDraw(dword bgcol, filenum){
{
itdir = TestBit(attr, 4);
strcpy(#file_name, file_name_off);
sprintf(#file_path,"%s%s",#path,file_name_off);
if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
else sprintf(#file_path,"%s/%s",#path,file_name_off);
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
}
if (file.selected) text_col=0xFF0000;
@ -746,10 +747,8 @@ void Open_Dir(dword dir_path, redraw){
if (redraw!=ONLY_SHOW)
{
selected_count = 0;
if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
if (buf) free(buf);
errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
if (errornum)
{
history.add(#path);
@ -866,14 +865,14 @@ void SelectFileByName(dword that_file)
void Dir_Up()
{
char cur_folder[4096];
char old_folder_name[4096];
i=strlen(#path)-1;
if (i==0) return;
path[i]=0x00;
//path[i]=0x00;
i = strrchr(#path, '/');
strcpy(#cur_folder, #path+i);
path[i]=0x00;
SelectFileByName(#cur_folder);
strcpy(#old_folder_name, #path+i);
if (i>1) path[i-1]=NULL; else path[i]=NULL;
SelectFileByName(#old_folder_name);
}
void Open(byte rez)
@ -884,7 +883,6 @@ void Open(byte rez)
{
if (!strncmp(#file_name,"..",3)) return;
strcpy(#temp, #file_path);
if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
RunProgram("/sys/File Managers/Eolite", #temp);
return;
}
@ -897,7 +895,6 @@ void Open(byte rez)
{
if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
strcpy(#path, #file_path);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
files.first=files.cur_y=0;
Open_Dir(#path,WITH_REDRAW);
}
@ -907,7 +904,6 @@ inline fastcall void GoBack()
{
char cur_folder[4096];
strcpy(#cur_folder, #path);
cur_folder[strlen(#cur_folder)-1]=0x00; //delete last '/'
if (history.back()) {
strcpy(#path, history.current());
SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
@ -927,7 +923,7 @@ void NewElement(byte newf)
byte del_rezult, copy_rezult, info_result;
if (newf)
{
sprintf(#temp,"%s%s",#path,new_file_ed.text);
sprintf(#temp,"%s/%s",#path,new_file_ed.text);
info_result = GetFileInfo(#temp, #element_info);
switch(new_element_active)
{

View File

@ -26,14 +26,12 @@ void Copy(dword pcth, char cut)
if (files.count<=0) return; //no files
if (selected_count==0) setElementSelectedFlag(files.cur_y, true); //no element selected by "insert", so we copy current element
debugi(selected_count);
size_buf = 4;
for (i=0; i<files.count; i++)
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) {
strcpy(#copy_t, #path);
strcat(#copy_t, file_mas[i]*304+buf+72);
sprintf(#copy_t,"%s/%s",#path,file_mas[i]*304+buf+72);
path_len = strlen(#copy_t);
size_buf += path_len + 1;
}
@ -48,12 +46,10 @@ void Copy(dword pcth, char cut)
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) {
strcpy(copy_buf_offset, #path);
strcat(copy_buf_offset, file_mas[i]*304+buf+72);
sprintf(copy_buf_offset,"%s/%s",#path,file_mas[i]*304+buf+72);
copy_buf_offset += strlen(copy_buf_offset) + 1;
}
}
WriteFile(size_buf, buff_data, "/rd/1/log.log");
if (selected_count==1) setElementSelectedFlag(files.cur_y, false);
clipboard.SetSlotData(size_buf, buff_data);
cut_active = cut;
@ -96,13 +92,10 @@ void PasteThread()
for (j = 0; j < paste_elements_count; j++) {
strcpy(#copy_from, path_offset);
if (!copy_from) DialogExit();
strcpy(#copy_to, #path);
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
sprintf(#copy_to, "%s/%s", #path, #copy_from+strrchr(#copy_from,'/'));
if (!strcmp(#copy_from,#copy_to))
{
strcpy(#copy_to, #path);
strcat(#copy_to, "NEW_");
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
sprintf(#copy_to, "%s/NEW_%s", #path, #copy_from+strrchr(#copy_from,'/'));
}
if (strstr(#copy_to, #copy_from))
{

View File

@ -42,7 +42,7 @@ void Del_File_Thread()
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) {
sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72);
GetFileInfo(#del_from, #file_info_count);
if ( file_info_count.isfolder ) DirFileCount(#del_from);
else file_count_copy++;
@ -65,7 +65,7 @@ void Del_File_Thread()
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) {
sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72);
Del_File2(#del_from, 1);
}
}

View File

@ -103,18 +103,18 @@ void _SystemDiscs::Get()
dev_num = EBX;
for (i1=0; i1<dev_num; i1++)
{
sprintf(#dev_name,"/%s/",i1*304+ devbuf+72);
sprintf(#dev_name,"/%s",i1*304+ devbuf+72);
Open_Dir(#dev_name, ONLY_OPEN);
dev_disc_num = files.count;
for (j1=0; j1<dev_disc_num; j1++;)
{
sprintf(#sys_discs,"%s%s/",#dev_name,j1*304+ buf+72);
sprintf(#sys_discs,"%s/%s",#dev_name,j1*304+ buf+72);
list.add(#sys_discs);
}
if (!strcmp(#sys_discs, "/rd/1/"))
if (!strcmp(#sys_discs, "/rd/1"))
{
GetDir(#tempbuf, #temp_file_count, "/kolibrios", DIRS_ONLYREAL);
if (temp_file_count) list.add("/kolibrios/");
if (temp_file_count) list.add("/kolibrios");
free(tempbuf);
}
}
@ -134,7 +134,6 @@ void _SystemDiscs::Draw()
for (i=0;i<list.count;i++)
{
strcpy(#dev_name, list.get(i));
dev_name[strlen(#dev_name)-1]=NULL;
GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
if (strstr(#path, #dev_name)) is_active=true; else is_active=false;
if (two_panels)

View File

@ -203,7 +203,7 @@ void GetSizeMoreFiles(dword way)
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) {
sprintf(#cur_file,"%s%s",way,file_mas[i]*304+buf+72);
sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72);
if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) )
{
GetSizeDir(#cur_file);

View File

@ -144,8 +144,8 @@ void LoadIniSettings()
ini_get_int stdcall (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "WinH", 506); WinH = EAX;
ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1/");
ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,4096,"/rd/1/");
ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1");
ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,4096,"/rd/1");
path_start_ed.size = strlen(#path_start);
path_start_ed.pos = strlen(#path_start);

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager v3.67"
#define ABOUT_TITLE "EOLITE 3.67"
#define TITLE "Eolite File Manager v3.68"
#define ABOUT_TITLE "EOLITE 3.68"
#ifdef LANG_RUS
?define T_FILE "” ©«"