Corretta funzione update
Aggiunto autocaricamento dei files "std/lf.....txt" nella build git-svn-id: svn://10.65.10.50/trunk@503 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0a35a208aa
commit
76af66e3f0
@ -33,6 +33,14 @@ HIDDEN void UNKNOWN_FIELD(int num, const char* name)
|
||||
|
||||
#define NOALLOC (char **) -1
|
||||
|
||||
HIDDEN bool __autoload = TRUE;
|
||||
|
||||
void set_autoload_new_files(bool on)
|
||||
|
||||
{
|
||||
__autoload = on;
|
||||
}
|
||||
|
||||
class TExtrectype : public TRectype
|
||||
{
|
||||
public:
|
||||
@ -795,6 +803,14 @@ int TSystemisamfile::build(TRecnotype eox)
|
||||
cisbuild(filehnd(), num(), eox, &err);
|
||||
setstatus(err);
|
||||
clearfilehnd();
|
||||
if (err == NOERR && __autoload)
|
||||
{
|
||||
TFilename lf;
|
||||
|
||||
lf.format("std/lf%04d.txt", num());
|
||||
if (fexist(lf))
|
||||
load(lf);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -878,18 +894,22 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
{
|
||||
if (filehnd() != NULL)
|
||||
fatal_box("Can't update description for open file %s", filename());
|
||||
int err = NOERR;
|
||||
TDir dir;
|
||||
|
||||
dir.get(num(), _lock, _nordir, _sysdirop);
|
||||
const char p = *dir.name();
|
||||
const bool toconvert = ((strcmp(prefhndl->name(), "com") == 0) ? p == '%' : p != '%');
|
||||
|
||||
int err = NOERR;
|
||||
TTrec oldrec;
|
||||
|
||||
oldrec.get(num());
|
||||
const bool lcf = getlcf(prefhndl->filelevel());
|
||||
|
||||
if (!lcf && newrec == oldrec) return NOERR;
|
||||
dir.get(num(), _lock, _nordir, _sysdirop);
|
||||
const TRecnotype nitems = dir.eod();
|
||||
const unsigned int lenr = newrec.len();
|
||||
if (dir.eox() > 0L)
|
||||
if (toconvert && dir.eox() > 0L)
|
||||
{
|
||||
TRecnotype ni = 0L;
|
||||
TFilename tmpfname;
|
||||
@ -908,7 +928,7 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
TFilename fname(filename());
|
||||
TString s(80);
|
||||
s.format("Aggiornamento archivio %s", (const char*) fname);
|
||||
TProgind p(nitems ? nitems : 1, s, TRUE, TRUE, 50);
|
||||
TProgind p(nitems ? nitems : 1, s, TRUE, TRUE, 70);
|
||||
int nflds = curr().items();
|
||||
TArray fld(nflds);
|
||||
TExtrectype nrec(newrec);
|
||||
@ -944,7 +964,7 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
dir.set_len(lenr);
|
||||
dir.put(num(), _nordir, _sysdirop);
|
||||
newrec.put(num());
|
||||
if (dir.eox() > 0L) packindex();
|
||||
if (toconvert && dir.eox() > 0L) packindex();
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1150,7 +1170,7 @@ int TSystemisamfile::dump(const char* to, int nkey, char fs, char fd, char rs, b
|
||||
TRecnotype i = 0;
|
||||
const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;
|
||||
s.format("Esportazione archivio %s", filename());
|
||||
TProgind p(nitems, s, TRUE, TRUE, 50);
|
||||
TProgind p(nitems, s, TRUE, TRUE, 70);
|
||||
TString s1;
|
||||
|
||||
fprintf(f, "[Header]\nVersion=%ld", prefhndl->filelevel());
|
||||
|
Loading…
x
Reference in New Issue
Block a user