Creato in automatico il file se nono esiste

git-svn-id: svn://10.65.10.50/trunk@374 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1994-10-14 18:05:32 +00:00
parent fb895b5f16
commit 4e85b0cbf4

View File

@ -112,7 +112,7 @@ bool BA1100_application::create() // initvar e arrmask
_mask = new TMask ("ba1100a");
set_firm();
_browse = new TDir_sheet ("Manutenzione file di sistema") ;
_browse->add_button(DLG_INSFILE, "Inserisce", K_F4);
_browse->add_button(DLG_INSFILE, "Inserisce", K_F6);
_browse->add_button(DLG_CONVERT, "Converte", K_F7);
_browse->add_button(DLG_ADDFILE, "Aggiunge", K_F8);
dispatch_e_menu(BAR_ITEM(1));
@ -340,7 +340,7 @@ void BA1100_application::update_dir()
prefhndl->set("");
TDir d;
const bool update_com = ( pref == "com");
d.get(LF_DIR);
const int orig_items = (int)d.eod();
@ -353,17 +353,32 @@ void BA1100_application::update_dir()
{
prefhndl->set("");
d.get(i, _nolock, _nordir, _sysdirop);
if (d.flags() == -1)
TString desc(d.des());
TString s(d.name());
long flags = d.flags();
word len = d.len();
prefhndl->set(pref);
d.get(i, _nolock, _nordir, _sysdirop);
bool to_create = (update_com ? *d.name() == '%' : *d.name() == '$');
if (flags == -1)
{
TString s(d.name());
word len = d.len();
prefhndl->set(pref);
d.get(i, _nolock, _nordir, _sysdirop);
if (len != d.len() && s != d.name())
{
d.set(s, d.eox(), 0L, d.des(), d.expr());
d.put(i, _nordir, _sysdirop);
}
d.set(s, d.eox(), 0L, desc, d.expr());
else
strcpy((char *) d.des(), desc);
}
else
strcpy((char *) d.des(), desc);
d.put(i, _nordir, _sysdirop);
d.get(i);
TFilename datafile(d.name());
if (to_create && !fexist(datafile))
{
TSystemisamfile f(i);
f.build(10L);
}
}
prefhndl->set(pref);
@ -460,7 +475,7 @@ bool BA1100_application::menu(MENU_TAG m)
switch (_browse->run())
{
case K_INS:
case K_F6:
riga_selezionata = _browse->selected();
riga = _browse->row();
insert_riga (riga_selezionata, riga);