Corretta la update_dir() nel caso in cui deve cambiare nome ai files
ed effettuare le copie. Qui e' contemplato anche il caso in cui Un file comune non ha il '%' in dir.gen di com. git-svn-id: svn://10.65.10.50/trunk@1906 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b8d971ef06
commit
1508e0087c
199
ba/ba1100.cpp
199
ba/ba1100.cpp
@ -574,121 +574,102 @@ void TManutenzione_app::update_dir()
|
|||||||
}
|
}
|
||||||
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 (to_create)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
TDir d1;
|
||||||
if (to_create)
|
|
||||||
{
|
|
||||||
TDir d1;
|
|
||||||
|
|
||||||
prefix().set("");
|
prefix().set("");
|
||||||
d1.get(i);
|
d1.get(i);
|
||||||
|
|
||||||
TFilename fd(d1.name());
|
TFilename fd(d1.name());
|
||||||
|
|
||||||
prefix().set(pref);
|
prefix().set(pref);
|
||||||
d1.get(i);
|
d1.get(i);
|
||||||
TFilename fs(d1.name());
|
TFilename fs(d1.name());
|
||||||
|
|
||||||
fs.ext("dbf");
|
fs.ext("dbf");
|
||||||
fd.ext("dbf");
|
fd.ext("dbf");
|
||||||
|
if (is_firm)
|
||||||
|
{
|
||||||
|
TString name(fd);
|
||||||
|
fd.cut(0);
|
||||||
|
fd << fs.path() << name;
|
||||||
|
}
|
||||||
|
|
||||||
if (fexist(fs))
|
if (fexist(fs) && (fd != fs))
|
||||||
{
|
|
||||||
if (is_firm)
|
|
||||||
{
|
|
||||||
TString name(fd);
|
|
||||||
fd.cut(0);
|
|
||||||
fd << fs.path() << name;
|
|
||||||
}
|
|
||||||
if (fd != fs)
|
|
||||||
{
|
|
||||||
TFilename path(fd.path());
|
|
||||||
|
|
||||||
path.rtrim(1);
|
|
||||||
if (path.not_empty() && !fexist(path))
|
|
||||||
ok = make_dir(path);
|
|
||||||
if (ok && fcopy(fs, fd))
|
|
||||||
{
|
|
||||||
TToken_string ts(10),td(10);
|
|
||||||
td.cut(0);
|
|
||||||
get_idx_names(i,ts); // Get index names of current file in current dir
|
|
||||||
for (int j=1; j<= ts.items() && ok; j++)
|
|
||||||
{
|
|
||||||
const TFilename fsi(ts.get());
|
|
||||||
TFilename fdi(fd); // Nuovo nome. (Con l'estensione)
|
|
||||||
fdi.ext("");
|
|
||||||
if (j > 1) // Means that more indexes are in TToken_string ts
|
|
||||||
{
|
|
||||||
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");
|
|
||||||
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 fdi(CGetIdxName((char *)(const char *)fd));
|
|
||||||
//
|
|
||||||
// if (fcopy(fsi, fdi))
|
|
||||||
// {
|
|
||||||
// remove(fs);
|
|
||||||
// remove(fsi);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// remove(fd);
|
|
||||||
// ok = FALSE;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ok = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok)
|
|
||||||
{
|
{
|
||||||
d.set(s, d.eox(), 0L, desc, d.expr());
|
bool ok = TRUE;
|
||||||
towrite = TRUE;
|
TFilename path(fd.path());
|
||||||
}
|
|
||||||
|
path.rtrim(1);
|
||||||
|
if (path.not_empty() && !fexist(path))
|
||||||
|
ok = make_dir(path);
|
||||||
|
if (ok && fcopy(fs, fd))
|
||||||
|
{
|
||||||
|
TToken_string ts(10),td(10);
|
||||||
|
td.cut(0);
|
||||||
|
get_idx_names(i,ts); // Get index names of current file in current dir
|
||||||
|
for (int j=1; j<= ts.items() && ok; j++)
|
||||||
|
{
|
||||||
|
const TFilename fsi(ts.get());
|
||||||
|
TFilename fdi(fd); // Nuovo nome. (Con l'estensione)
|
||||||
|
fdi.ext("");
|
||||||
|
if (j > 1) // Means that more indexes are in TToken_string ts
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ok = FALSE;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
d.set(s, d.eox(), 0L, desc, d.expr());
|
||||||
|
towrite = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -699,7 +680,7 @@ void TManutenzione_app::update_dir()
|
|||||||
if (towrite)
|
if (towrite)
|
||||||
d.put(i, _nordir, _sysdirop);
|
d.put(i, _nordir, _sysdirop);
|
||||||
d.get(i);
|
d.get(i);
|
||||||
}
|
} // end of for scope
|
||||||
prefix().set(pref);
|
prefix().set(pref);
|
||||||
|
|
||||||
if (items >= orig_items) return;
|
if (items >= orig_items) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user