Patch level : 4.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Migliorata la numerazione automatica dei file
che il postino salva su cartella invece che spedire via posta


git-svn-id: svn://10.65.10.50/trunk@14836 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2007-02-01 15:56:06 +00:00
parent c28332be48
commit 2c2ed28f5a

View File

@ -1,9 +1,13 @@
#include <applicat.h>
#include <expr.h>
#include <golem.h>
#include <recarray.h>
#include <relapp.h>
#include <relation.h>
#include <scanner.h>
#include <utility.h>
#include <time.h>
///////////////////////////////////////////////////////////
// TRecipient
///////////////////////////////////////////////////////////
@ -218,16 +222,35 @@ bool TPostman::dispatch_transaction(const TRectype& rec,
if (file_dest.items() > 0)
{
for (const char* r = file_dest.get(0); r; r = file_dest.get())
TString16 basename;
time_t lt; time(&lt);
struct tm * tl = localtime(&lt);
basename.format("%02d%02d%02d_%02d%02d%02d_0",
tl->tm_year%100, tl->tm_mon+1, tl->tm_mday,
tl->tm_hour, tl->tm_min, tl->tm_sec);
FOR_EACH_TOKEN(file_dest, r)
{
if (fexist(r))
{
TFilename output(r);
output.add(name.name());
ok &= fcopy(name, output);
TFilename output;
int retry = 0;
for (retry = 0; retry < 10; retry++) // Per ora tento solo 10 volte
{
output = r;
output.add(basename);
output << retry << ".ini";
if (!output.exist()) // Ho generato un nome buono
break;
}
if (retry >= 10)
ok = false;
else
ok = fcopy(name, output);
}
else
error_box("Non esiste la cartella %s", r);
ok = error_box("Non esiste la cartella %s", r);
}
}
}
return ok;