Aggiunta modalita per aprire i file temporanei in un direttorio fissato
git-svn-id: svn://10.65.10.50/trunk@1161 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0184ad1f8b
commit
b0c86b6db0
@ -774,16 +774,39 @@ TIsamtempfile::TIsamtempfile(int logicnum, const char* radix, bool create)
|
||||
{
|
||||
TRecnotype eod = 0;
|
||||
TRecnotype eox = 100;
|
||||
|
||||
TFilename n;
|
||||
|
||||
TFilename n; n.tempdir(); n << '/' << radix; n.ext("dta");
|
||||
if (radix && *radix)
|
||||
{
|
||||
if (*radix == '%')
|
||||
n = radix;
|
||||
else
|
||||
{
|
||||
n.tempdir();
|
||||
n << '/' << radix;
|
||||
}
|
||||
}
|
||||
|
||||
n.ext("dta");
|
||||
|
||||
if (!create)
|
||||
{
|
||||
TDir dir; dir.get(logicnum);
|
||||
const word& len = dir.len();
|
||||
const word& len = dir.len();
|
||||
|
||||
// Tolgo il % senno' che fa la fopen ?
|
||||
if (n[0] == '%')
|
||||
n = n.sub(1);
|
||||
|
||||
FILE* f = fopen(n, "r");
|
||||
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
CHECKS(f, "Can't open temporary file ", (const char*)strerror(NULL));
|
||||
#else
|
||||
CHECKS(f, "Can't open temporary file ", (const char*)n);
|
||||
#endif
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
eod = eox = ftell(f) / len;
|
||||
fclose(f);
|
||||
@ -791,8 +814,13 @@ TIsamtempfile::TIsamtempfile(int logicnum, const char* radix, bool create)
|
||||
|
||||
_autodel = create > TRUE;
|
||||
|
||||
n.ext("");
|
||||
n.insert("%", 0);
|
||||
n.ext("");
|
||||
|
||||
// Ci rimetto il % se prima l'avevo tolto, senno' che fa la open ?
|
||||
// if (*radix == '%')
|
||||
if (n[0] != '%')
|
||||
n.insert("%", 0);
|
||||
|
||||
open(n, create, eod, eox);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user