From d3eaeb214b50bba316d412dcf618cd59be8faa6e Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 15 Sep 1995 11:10:15 +0000 Subject: [PATCH] Correzione segnalata da rosalba alla conversione git-svn-id: svn://10.65.10.50/trunk@1831 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba1100.cpp | 137 ++++++++++++++++++++++++++++---------------------- 1 file changed, 76 insertions(+), 61 deletions(-) diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index e7b96ce55..1136d9b43 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -553,7 +553,18 @@ void TManutenzione_app::update_dir() } } 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); bool to_create = (is_com ? d.is_com() : d.is_firm()); if (s != d.name()) @@ -582,68 +593,71 @@ void TManutenzione_app::update_dir() TString name(fd); fd.cut(0); fd << fs.path() << name; - } - TFilename path(fd.path()); - path.rtrim(1); - if (path.not_empty() && !fexist(path)) - ok = make_dir(path); - if (ok && fcopy(fs, fd)) + } + if (fd != fs) { - 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++) + TFilename path(fd.path()); + + path.rtrim(1); + if (path.not_empty() && !fexist(path)) + ok = make_dir(path); + if (ok && fcopy(fs, fd)) { - 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) + 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++) { - 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()); + 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 (o!=NULL) - fclose(o); - } - else - { - remove(fd); // Remove all destinations written - td.restart(); - for (int j=1; j<=td.items(); j++) - remove(td.get()); - } + 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)); // @@ -657,9 +671,10 @@ void TManutenzione_app::update_dir() // remove(fd); // ok = FALSE; // } - } - else - ok = FALSE; + } + else + ok = FALSE; + } } } if (ok)