Aggiunto supporto per rilevazione modifiche alle cache da parte di utenti o sessioni contemporanee
git-svn-id: svn://10.65.10.50/branches/R_10_00@22786 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
13e6a3fa82
commit
cb54862461
@ -697,8 +697,11 @@ bool TApplication::get_spotlite_path(TFilename& path) const
|
||||
bool ok = dongle().active(RSAUT);
|
||||
if (ok)
|
||||
{
|
||||
path = prefix().get_studio(); // Legge il persorso dello studio corrente
|
||||
const TString16 study = path.name(); // Estrae il nome dello studio (senza percorso)
|
||||
if (prefix_valid())
|
||||
path = prefix().get_studio(); // Legge il persorso dello studio corrente
|
||||
else
|
||||
path = ini_get_string(CONFIG_INSTALL, "Main", "Study");
|
||||
const TString80 study = path.name(); // Estrae il nome dello studio (senza percorso)
|
||||
path.add("spotlite"); // Crea il nome standard della cartella per gli archivi
|
||||
ok = path.exist(); // Controlla se esiste gia'
|
||||
if (!ok)
|
||||
|
@ -4,9 +4,12 @@
|
||||
#include <relation.h>
|
||||
#include <tabmod.h>
|
||||
#include <tabutil.h>
|
||||
#include <xvt.h>
|
||||
|
||||
#include <user.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFast_isamfile
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -590,6 +593,8 @@ void TFile_cache::init_file(TLocalisamfile* f)
|
||||
else
|
||||
_file = f;
|
||||
|
||||
_last_file_test = _last_file_time = 0;
|
||||
|
||||
if (_file != NULL)
|
||||
{
|
||||
TDir dir;
|
||||
@ -620,6 +625,22 @@ void TFile_cache::test_firm()
|
||||
}
|
||||
}
|
||||
|
||||
if (_test_changes && !_changed && _file != NULL)
|
||||
{
|
||||
// Non controllare troppo spesso la data del file nei programmi batch: aspetta almeno 2 secondi!
|
||||
const unsigned long now = clock();
|
||||
if (now > _last_file_test + 2500)
|
||||
{
|
||||
TFilename n = prefix().get_filename(_file->num()); n.ext("dbf");
|
||||
FILE_SPEC fs; xvt_fsys_convert_str_to_fspec(n, &fs);
|
||||
const unsigned long ft = xvt_fsys_get_file_attr(&fs, XVT_FILE_ATTR_MTIME);
|
||||
if (ft > _last_file_time && _last_file_time > 0)
|
||||
_changed = true;
|
||||
_last_file_time = ft;
|
||||
_last_file_test = now;
|
||||
}
|
||||
}
|
||||
|
||||
const bool flush_needed = _test_changes && _changed && _file != NULL;
|
||||
|
||||
if (flush_needed)
|
||||
@ -754,6 +775,7 @@ void TFile_cache::destroy()
|
||||
{
|
||||
_cache.destroy();
|
||||
_changed = false;
|
||||
_last_file_test = _last_file_time = 0;
|
||||
}
|
||||
|
||||
TLocalisamfile & TFile_cache::file()
|
||||
|
@ -157,6 +157,7 @@ class TFile_cache : public TObject
|
||||
TLocalisamfile* _file;
|
||||
int _key;
|
||||
long _last_firm, _limit;
|
||||
unsigned long _last_file_test, _last_file_time;
|
||||
int _error;
|
||||
bool _test_changes, _changed;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user