app_plus: show message if /kolibrios/settings/app_plus.ini not found

git-svn-id: svn://kolibrios.org@6251 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-02-19 00:33:21 +00:00
parent 036bb48ceb
commit 3f4201dc21
9 changed files with 38 additions and 25 deletions

View File

@ -20,13 +20,29 @@ dword scr = FROM "scr.raw_8bit";
dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
#define APP_PLUS_INI_PATH "/kolibrios/settings/app_plus.ini"
#define APP_PLUS_INI_NOT_EXISTS "'APP+\n/kolibrios/settings/app_plus.ini is not exists.\nProgram terminated.' -tE"
#define WINDOW_TITLE_TEXT "Error"
#define CONTENT_HEADER_TEXT "/KOLIBRIOS/ NOT MOUNTED"
#define DESCRIPTION_TEXT "Try to find it manually. It should look
like image on the right.
Note: this action can be done only once
per 1 session of the OS running. If you
will choose the wrong folder then you
need to reboot system to try again."
#define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
void CheckKosMounted()
{
if (isdir("/kolibrios/"))
if (dir_exists("/kolibrios/"))
{
io.run("syspanel", "/kolibrios/settings/app_plus.ini");
if (file_exists(APP_PLUS_INI_PATH))
io.run("syspanel", APP_PLUS_INI_PATH);
else
notify(APP_PLUS_INI_NOT_EXISTS);
ExitProcess();
}
}
@ -69,17 +85,6 @@ void main()
}
}
#define WINDOW_TITLE_TEXT "Error"
#define CONTENT_HEADER_TEXT "/KOLIBRIOS/ NOT MOUNTED"
#define DESCRIPTION_TEXT "Try to find it manually. It should look
like image on the right.
Note: this action can be done only once
per 1 session of the OS running. If you
will choose the wrong folder then you
need to reboot system to try again."
#define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
void draw_window()
{
incn y;

View File

@ -153,7 +153,7 @@ void DrawWindowContent()
DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light);
DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work);
DrawTab(list.x+10, list.y, SKINS, T_SKINS);
if (isdir(WALP_STANDART_PATH)) DrawTab(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS);
if (dir_exists(WALP_STANDART_PATH)) DrawTab(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS);
DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph);
Draw_List();

View File

@ -857,7 +857,7 @@ int Del_File2(dword way, sh_progr)
dword dirbuf, fcount, i, filename;
int error;
char del_from[4096];
if (isdir(way))
if (dir_exists(way))
{
if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
for (i=0; i<fcount; i++)

View File

@ -5,7 +5,7 @@ void DirFileCount(dword way)
{
dword dirbuf, fcount, i, filename;
dword cur_file;
if (isdir(way))
if (dir_exists(way))
{
cur_file = malloc(4096);
// In the process of recursive descent, memory must be allocated dynamically, because the static memory -> was a bug !!! But unfortunately pass away to sacrifice speed.

View File

@ -57,7 +57,7 @@ void SetPropertiesDir(dword way)
{
dword dirbuf, fcount, i, filename;
dword cur_file;
if (isdir(way))
if (dir_exists(way))
{
cur_file = malloc(4096);
GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
@ -105,7 +105,7 @@ void SetProperties(byte prop)
SetFileInfo(cur_file, #file_info_general);
if (prop==2)
{
if (isdir(cur_file))
if (dir_exists(cur_file))
{
SetPropertiesDir(cur_file);
}
@ -155,7 +155,7 @@ void GetSizeDir(dword way)
{
dword dirbuf, fcount, i, filename;
dword cur_file;
if (isdir(way))
if (dir_exists(way))
{
cur_file = malloc(4096);
// In the process of recursive descent, memory must be allocated dynamically,

View File

@ -24,7 +24,7 @@
debugln("Error: copyf->GetFileInfo");
return error;
}
if (isdir(from1))
if (dir_exists(from1))
return CopyFolder(from1, in1);
else
{
@ -85,7 +85,7 @@
sprintf(#copy_from2,"%s/%s",from2,filename);
sprintf(#copy_in2,"%s/%s",in2,filename);
if ( TestBit(ESDWORD[filename-40], 4) ) //isdir?
if ( TestBit(ESDWORD[filename-40], 4) ) //dir_exists?
{
if ( (!strncmp(filename, ".",1)) || (!strncmp(filename, "..",2)) ) continue;
CopyFolder(#copy_from2, #copy_in2);

View File

@ -197,15 +197,23 @@
$int 0x40
}
:char isdir(dword fpath)
:char dir_exists(dword fpath)
{
BDVK fpath_atr;
GetFileInfo(fpath, #fpath_atr);
return fpath_atr.isfolder;
}
:char file_exists(dword fpath)
{
BDVK ReadFile_atr;
if (! GetFileInfo(fpath, #ReadFile_atr)) return true;
return false;
}
:int GetFile(dword buf, filesize, read_path)
{
int return_val = 0;
BDVK ReadFile_atr;
dword rBuf;
if (! GetFileInfo(read_path, #ReadFile_atr))
@ -215,11 +223,11 @@
{
ESDWORD[buf] = rBuf;
ESDWORD[filesize] = ReadFile_atr.sizelo;
return 1;
return_val = 1;
}
}
free(rBuf);
return 0;
return return_val;
}
enum

View File

@ -58,7 +58,7 @@ void main()
Libimg_LoadImage(#skin, "/sys/icons32.png");
Libimg_FillTransparent(skin.image, skin.w, skin.h, LIST_BACKGROUND_COLOR);
kolibrios_mounted = isdir("/kolibrios");
kolibrios_mounted = dir_exists("/kolibrios");
if (param)
{