forked from KolibriOS/kolibrios
c-- apps: never use libio
Eolite: fixed bug that file or folder was not selected in case when it had to git-svn-id: svn://kolibrios.org@8392 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
91fe30428d
commit
e52ed5b883
@ -21,7 +21,6 @@
|
|||||||
#include "..\lib\clipboard.h"
|
#include "..\lib\clipboard.h"
|
||||||
|
|
||||||
#include "..\lib\obj\box_lib.h"
|
#include "..\lib\obj\box_lib.h"
|
||||||
#include "..\lib\obj\libio.h"
|
|
||||||
#include "..\lib\obj\libimg.h"
|
#include "..\lib\obj\libimg.h"
|
||||||
#include "..\lib\obj\http.h"
|
#include "..\lib\obj\http.h"
|
||||||
#include "..\lib\obj\iconv.h"
|
#include "..\lib\obj\iconv.h"
|
||||||
@ -97,7 +96,6 @@ edit_box omnibox_edit = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff,
|
|||||||
void LoadLibraries()
|
void LoadLibraries()
|
||||||
{
|
{
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
load_dll(libio, #libio_init,1);
|
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
load_dll(libHTTP, #http_lib_init,1);
|
load_dll(libHTTP, #http_lib_init,1);
|
||||||
load_dll(iconv_lib, #iconv_open,0);
|
load_dll(iconv_lib, #iconv_open,0);
|
||||||
@ -488,12 +486,7 @@ bool HandleUrlFiles(dword _path, _data)
|
|||||||
bool GetLocalFileData(dword _path)
|
bool GetLocalFileData(dword _path)
|
||||||
{
|
{
|
||||||
dword data, size;
|
dword data, size;
|
||||||
file_size stdcall (_path);
|
read_file(_path, #data, #size);
|
||||||
if (!EBX) return false;
|
|
||||||
|
|
||||||
size = EBX;
|
|
||||||
data = malloc(size);
|
|
||||||
ReadFile(0, size, data, _path);
|
|
||||||
if (!HandleUrlFiles(_path, data)) {
|
if (!HandleUrlFiles(_path, data)) {
|
||||||
LoadInternalPage(data, size);
|
LoadInternalPage(data, size);
|
||||||
}
|
}
|
||||||
@ -812,13 +805,6 @@ void EventRefreshPage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dword GetFileSize(dword _path)
|
|
||||||
{
|
|
||||||
BDVK bdvk;
|
|
||||||
if (GetFileInfo(_path, #bdvk)!=0) return 0;
|
|
||||||
else return bdvk.sizelo;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EventUpdateBrowser()
|
void EventUpdateBrowser()
|
||||||
{
|
{
|
||||||
dword downloader_id, slot_n;
|
dword downloader_id, slot_n;
|
||||||
@ -833,8 +819,8 @@ void EventUpdateBrowser()
|
|||||||
pause(10);
|
pause(10);
|
||||||
} while (slot_n!=0);
|
} while (slot_n!=0);
|
||||||
|
|
||||||
current_size = GetFileSize(#program_path);
|
current_size = get_file_size(#program_path);
|
||||||
new_size = GetFileSize("/tmp0/1/Downloads/WebView.com");
|
new_size = get_file_size("/tmp0/1/Downloads/WebView.com");
|
||||||
|
|
||||||
if (!new_size) || (new_size<5000) {
|
if (!new_size) || (new_size<5000) {
|
||||||
notify(#update_download_error);
|
notify(#update_download_error);
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
// 70.5 - get volume info and label
|
// 70.5 - get volume info and label
|
||||||
|
|
||||||
#define TITLE "Eolite File Manager 4.47a"
|
#define TITLE "Eolite File Manager 4.48"
|
||||||
#define ABOUT_TITLE "EOLITE 4.47a"
|
#define ABOUT_TITLE "EOLITE 4.48"
|
||||||
|
|
||||||
#ifndef AUTOBUILD
|
#ifndef AUTOBUILD
|
||||||
#include "lang.h--"
|
#include "lang.h--"
|
||||||
@ -23,7 +23,6 @@
|
|||||||
#include "../lib/collection.h"
|
#include "../lib/collection.h"
|
||||||
#include "../lib/copyf.h"
|
#include "../lib/copyf.h"
|
||||||
|
|
||||||
#include "../lib/obj/libio.h"
|
|
||||||
#include "../lib/obj/libini.h"
|
#include "../lib/obj/libini.h"
|
||||||
#include "../lib/obj/box_lib.h"
|
#include "../lib/obj/box_lib.h"
|
||||||
#include "../lib/obj/libimg.h"
|
#include "../lib/obj/libimg.h"
|
||||||
@ -156,7 +155,6 @@ void load_libraries()
|
|||||||
{
|
{
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
load_dll(libini, #lib_init,1);
|
load_dll(libini, #lib_init,1);
|
||||||
load_dll(libio, #libio_init,1);
|
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,12 +214,12 @@ void main()
|
|||||||
if (dir_exists(#param)) {
|
if (dir_exists(#param)) {
|
||||||
strcpy(#path, #param);
|
strcpy(#path, #param);
|
||||||
} else {
|
} else {
|
||||||
file_size stdcall (#param);
|
if (file_exists(#param)) {
|
||||||
if (EAX==-1) notify(T_NOTIFY_APP_PARAM_WRONG);
|
|
||||||
else {
|
|
||||||
param[strrchr(#param, '/')-1] = '\0';
|
param[strrchr(#param, '/')-1] = '\0';
|
||||||
strcpy(#path, #param);
|
strcpy(#path, #param);
|
||||||
SelectFileByName(#param+strlen(#param)+1);
|
SelectFileByName(#param+strlen(#param)+1);
|
||||||
|
} else {
|
||||||
|
notify(T_NOTIFY_APP_PARAM_WRONG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -942,7 +940,7 @@ void SelectFileByName(dword that_file)
|
|||||||
files.KeyHome();
|
files.KeyHome();
|
||||||
Open_Dir(#path,ONLY_OPEN);
|
Open_Dir(#path,ONLY_OPEN);
|
||||||
if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
|
if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
|
||||||
for (ind=files.count-1; ind>=0; ind--;) { if (streq(items.get(ind)*304+buf+72,that_file)) break; }
|
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
|
||||||
files.cur_y = ind - 1;
|
files.cur_y = ind - 1;
|
||||||
files.KeyDown();
|
files.KeyDown();
|
||||||
DrawStatusBar();
|
DrawStatusBar();
|
||||||
|
@ -221,6 +221,13 @@ void read_file(dword path1, buf, size)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:dword get_file_size(dword _path)
|
||||||
|
{
|
||||||
|
BDVK bdvk;
|
||||||
|
if (GetFileInfo(_path, #bdvk)!=0) return 0;
|
||||||
|
else return bdvk.sizelo;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// This implementation of dir_exists() is faster than
|
// This implementation of dir_exists() is faster than
|
||||||
// previous but here virtual folders like
|
// previous but here virtual folders like
|
||||||
|
@ -28,7 +28,6 @@ TODO
|
|||||||
|
|
||||||
#include "../lib/obj/iconv.h"
|
#include "../lib/obj/iconv.h"
|
||||||
#include "../lib/obj/box_lib.h"
|
#include "../lib/obj/box_lib.h"
|
||||||
#include "../lib/obj/libio.h"
|
|
||||||
#include "../lib/obj/proc_lib.h"
|
#include "../lib/obj/proc_lib.h"
|
||||||
#include "../lib/obj/librasterworks.h"
|
#include "../lib/obj/librasterworks.h"
|
||||||
|
|
||||||
@ -129,7 +128,6 @@ void main()
|
|||||||
int id;
|
int id;
|
||||||
|
|
||||||
load_dll(boxlib, #box_lib_init, 0);
|
load_dll(boxlib, #box_lib_init, 0);
|
||||||
load_dll(libio, #libio_init, 1);
|
|
||||||
//load_dll(libini, #lib_init, 1);
|
//load_dll(libini, #lib_init, 1);
|
||||||
load_dll(iconv_lib, #iconv_open, 0);
|
load_dll(iconv_lib, #iconv_open, 0);
|
||||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||||
@ -250,18 +248,12 @@ void OpenFile(dword _path)
|
|||||||
strcpy(#param, _path);
|
strcpy(#param, _path);
|
||||||
sprintf(#win_title, "%s - %s", TITLE, #param);
|
sprintf(#win_title, "%s - %s", TITLE, #param);
|
||||||
rows.KeyHome();
|
rows.KeyHome();
|
||||||
file_size stdcall (#param);
|
read_file(#param, #bufpointer, #bufsize);
|
||||||
bufsize = EBX;
|
if (!EAX)
|
||||||
if (bufsize)
|
|
||||||
{
|
{
|
||||||
bufpointer = mem_Free(bufpointer);
|
bufpointer = 0;
|
||||||
bufpointer = mem_Alloc(bufsize);
|
notify("'Error opening file'-E");
|
||||||
if (ReadFile(0, bufsize, bufpointer, #param) != 0)
|
return;
|
||||||
{
|
|
||||||
bufpointer = 0;
|
|
||||||
notify("'Error opening file'-E");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (encoding!=CH_CP866)
|
if (encoding!=CH_CP866)
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
#define MEMSIZE 1024*50
|
#define MEMSIZE 1024*50
|
||||||
|
|
||||||
#include "../lib/io.h"
|
|
||||||
#include "../lib/gui.h"
|
#include "../lib/gui.h"
|
||||||
#include "../lib/copyf.h"
|
#include "../lib/copyf.h"
|
||||||
|
|
||||||
#include "../lib/obj/libini.h"
|
#include "../lib/obj/libini.h"
|
||||||
#include "../lib/obj/libio.h"
|
|
||||||
#include "../lib/obj/libimg.h"
|
#include "../lib/obj/libimg.h"
|
||||||
#include "../lib/obj/http.h"
|
#include "../lib/obj/http.h"
|
||||||
#include "../lib/obj/network.h"
|
#include "../lib/obj/network.h"
|
||||||
@ -58,7 +56,6 @@ void main()
|
|||||||
{
|
{
|
||||||
int btn;
|
int btn;
|
||||||
sensor progress;
|
sensor progress;
|
||||||
load_dll(libio, #libio_init,1);
|
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
load_dll(libHTTP, #http_lib_init,1);
|
load_dll(libHTTP, #http_lib_init,1);
|
||||||
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_STACK);
|
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_STACK);
|
||||||
@ -127,8 +124,7 @@ dword GetFreeSpaceOfRamdisk()
|
|||||||
dword rdempty = malloc(1440*1024);
|
dword rdempty = malloc(1440*1024);
|
||||||
CreateFile(0, 1440*1024, rdempty, "/rd/1/rdempty");
|
CreateFile(0, 1440*1024, rdempty, "/rd/1/rdempty");
|
||||||
free(rdempty);
|
free(rdempty);
|
||||||
file_size stdcall ("/rd/1/rdempty");
|
rdempty = get_file_size("/rd/1/rdempty");
|
||||||
rdempty = EBX;
|
|
||||||
DeleteFile("/rd/1/rdempty");
|
DeleteFile("/rd/1/rdempty");
|
||||||
return rdempty;
|
return rdempty;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "../lib/fs.h"
|
#include "../lib/fs.h"
|
||||||
#include "../lib/list_box.h"
|
#include "../lib/list_box.h"
|
||||||
|
|
||||||
#include "../lib/obj/libio.h"
|
|
||||||
#include "../lib/obj/libimg.h"
|
#include "../lib/obj/libimg.h"
|
||||||
#include "../lib/obj/box_lib.h"
|
#include "../lib/obj/box_lib.h"
|
||||||
|
|
||||||
@ -100,7 +99,6 @@ int right_w;
|
|||||||
|
|
||||||
void load_lib()
|
void load_lib()
|
||||||
{
|
{
|
||||||
load_dll(libio, #libio_init,1);
|
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
}
|
}
|
||||||
@ -260,8 +258,7 @@ void MonitorRd()
|
|||||||
dword rdempty = malloc(1440*1024);
|
dword rdempty = malloc(1440*1024);
|
||||||
CreateFile(0, 1440*1024, rdempty, "/rd/1/rdempty");
|
CreateFile(0, 1440*1024, rdempty, "/rd/1/rdempty");
|
||||||
free(rdempty);
|
free(rdempty);
|
||||||
file_size stdcall ("/rd/1/rdempty");
|
rdempty = get_file_size("/rd/1/rdempty") / 1024;
|
||||||
rdempty = EBX / 1024;
|
|
||||||
DeleteFile("/rd/1/rdempty");
|
DeleteFile("/rd/1/rdempty");
|
||||||
|
|
||||||
sprintf(#param, T_RD_USAGE, rdempty);
|
sprintf(#param, T_RD_USAGE, rdempty);
|
||||||
@ -288,10 +285,9 @@ void MonitorTmp()
|
|||||||
dword free_space;
|
dword free_space;
|
||||||
for (i=0; i<=9; i++)
|
for (i=0; i<=9; i++)
|
||||||
{
|
{
|
||||||
file_size stdcall ( sprintf(#param, "/tmp%i/1", i) );
|
get_file_size( sprintf(#param, "/tmp%i/1", i) );
|
||||||
tmp_size[i] = EBX / 1024 / 1024;
|
if (EAX) {
|
||||||
|
tmp_size[i] = EAX / 1024 / 1024;
|
||||||
if (EBX) {
|
|
||||||
free_space = tmp_size[i] - GetTmpDiskFreeSpace(i);
|
free_space = tmp_size[i] - GetTmpDiskFreeSpace(i);
|
||||||
sprintf(#text_status, T_TMP_USAGE, i, free_space, tmp_size[i]);
|
sprintf(#text_status, T_TMP_USAGE, i, free_space, tmp_size[i]);
|
||||||
tmp.set_size(RIGHT_X, yy, right_w, 23);
|
tmp.set_size(RIGHT_X, yy, right_w, 23);
|
||||||
|
Loading…
Reference in New Issue
Block a user