diff --git a/programs/cmm/app_plus/app_plus.c b/programs/cmm/app_plus/app_plus.c index cf35d4289c..9268548169 100644 --- a/programs/cmm/app_plus/app_plus.c +++ b/programs/cmm/app_plus/app_plus.c @@ -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; diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 33149f82cb..f640147184 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -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(); diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 0088904580..6dbe99e0b7 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -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 was a bug !!! But unfortunately pass away to sacrifice speed. diff --git a/programs/cmm/eolite/include/properties.h b/programs/cmm/eolite/include/properties.h index 85faeb9165..c9ad426082 100644 --- a/programs/cmm/eolite/include/properties.h +++ b/programs/cmm/eolite/include/properties.h @@ -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, diff --git a/programs/cmm/examples/compile.bat b/programs/cmm/examples/compile_en.bat similarity index 100% rename from programs/cmm/examples/compile.bat rename to programs/cmm/examples/compile_en.bat diff --git a/programs/cmm/lib/copyf.h b/programs/cmm/lib/copyf.h index 569643461f..8962fbaa09 100644 --- a/programs/cmm/lib/copyf.h +++ b/programs/cmm/lib/copyf.h @@ -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); diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index d89a52af11..2eaf837263 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -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 diff --git a/programs/cmm/software_widget/software_widget.c b/programs/cmm/software_widget/software_widget.c index 73567206ee..06f9d3712c 100644 --- a/programs/cmm/software_widget/software_widget.c +++ b/programs/cmm/software_widget/software_widget.c @@ -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) {