Correzione segnalata da rosalba alla conversione

git-svn-id: svn://10.65.10.50/trunk@1831 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1995-09-15 11:10:15 +00:00
parent 3e33129bc0
commit d3eaeb214b

View File

@ -553,7 +553,18 @@ void TManutenzione_app::update_dir()
} }
} }
else else
TLocalisamfile f(i); if (d.len() > 0)
{
TLocalisamfile f(i);
}
else
{
remove(d.filename());
TToken_string idx_names;
get_idx_names(i, idx_names);
for (const char * idx_name = idx_names.get(); idx_name != NULL; idx_name = idx_names.get())
remove(idx_name);
}
d.get(i, _nolock, _nordir, _sysdirop); d.get(i, _nolock, _nordir, _sysdirop);
bool to_create = (is_com ? d.is_com() : d.is_firm()); bool to_create = (is_com ? d.is_com() : d.is_firm());
if (s != d.name()) if (s != d.name())
@ -582,68 +593,71 @@ void TManutenzione_app::update_dir()
TString name(fd); TString name(fd);
fd.cut(0); fd.cut(0);
fd << fs.path() << name; fd << fs.path() << name;
} }
TFilename path(fd.path()); if (fd != fs)
path.rtrim(1);
if (path.not_empty() && !fexist(path))
ok = make_dir(path);
if (ok && fcopy(fs, fd))
{ {
TToken_string ts(10),td(10); TFilename path(fd.path());
td.cut(0);
get_idx_names(i,ts); // Get index names of current file in current dir path.rtrim(1);
for (int j=1; j<= ts.items() && ok; j++) if (path.not_empty() && !fexist(path))
ok = make_dir(path);
if (ok && fcopy(fs, fd))
{ {
const TFilename fsi(ts.get()); TToken_string ts(10),td(10);
TFilename fdi(fd); // Nuovo nome. (Con l'estensione) td.cut(0);
fdi.ext(""); get_idx_names(i,ts); // Get index names of current file in current dir
if (j > 1) // Means that more indexes are in TToken_string ts for (int j=1; j<= ts.items() && ok; j++)
{
TString xx=fdi.name();
if (xx.len() < 8)
fdi << ('0' + j);
else
fdi[8] = ('0' + j);
}
fdi.ext(fsi.ext());
td.add(fdi);
if (!fcopy(fsi, fdi))
ok = FALSE;
}
if (ok)
{
remove(fs); // Rimuove i files sorgenti. Crea un eventuale .cgp
fd.ext("cgp");
FILE *o=NULL;
if (ts.items() > 1)
{ {
fs.ext("cgp"); const TFilename fsi(ts.get());
remove(fs); TFilename fdi(fd); // Nuovo nome. (Con l'estensione)
o=fopen(fd,"w"); fdi.ext("");
} if (j > 1) // Means that more indexes are in TToken_string ts
ts.restart(); {
td.restart(); TString xx=fdi.name();
for (int j=1; j<=ts.items(); j++) if (xx.len() < 8)
{ fdi << ('0' + j);
remove(ts.get()); else
if (ts.items() > 1) // Means that fd.cgp must be created fdi[8] = ('0' + j);
{
TFilename ff=td.get();
ff.ext("");
ff.rtrim(1);
fprintf(o,"%s\n",ff.name());
} }
fdi.ext(fsi.ext());
td.add(fdi);
if (!fcopy(fsi, fdi))
ok = FALSE;
} }
if (o!=NULL) if (ok)
fclose(o); {
} remove(fs); // Rimuove i files sorgenti. Crea un eventuale .cgp
else fd.ext("cgp");
{ FILE *o=NULL;
remove(fd); // Remove all destinations written if (ts.items() > 1)
td.restart(); {
for (int j=1; j<=td.items(); j++) fs.ext("cgp");
remove(td.get()); remove(fs);
} o=fopen(fd,"w");
}
ts.restart();
td.restart();
for (int j=1; j<=ts.items(); j++)
{
remove(ts.get());
if (ts.items() > 1) // Means that fd.cgp must be created
{
TFilename ff=td.get();
ff.ext("");
ff.rtrim(1);
fprintf(o,"%s\n",ff.name());
}
}
if (o!=NULL)
fclose(o);
}
else
{
remove(fd); // Remove all destinations written
td.restart();
for (int j=1; j<=td.items(); j++)
remove(td.get());
}
// const TFilename fsi(CGetIdxName((char *)(const char *)fs)); // const TFilename fsi(CGetIdxName((char *)(const char *)fs));
// const TFilename fdi(CGetIdxName((char *)(const char *)fd)); // const TFilename fdi(CGetIdxName((char *)(const char *)fd));
// //
@ -657,9 +671,10 @@ void TManutenzione_app::update_dir()
// remove(fd); // remove(fd);
// ok = FALSE; // ok = FALSE;
// } // }
} }
else else
ok = FALSE; ok = FALSE;
}
} }
} }
if (ok) if (ok)