2004-05-08 03:11:51 +02:00
|
|
|
#include "precompiled.h"
|
2004-05-13 19:23:07 +02:00
|
|
|
|
|
|
|
#include "res.h"
|
|
|
|
|
2004-06-04 19:44:56 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include "sysdep/win/wfam.h"
|
|
|
|
#else
|
|
|
|
#include <fam.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2004-05-13 19:23:07 +02:00
|
|
|
int res_reload(const char* const fn)
|
|
|
|
{
|
|
|
|
return h_reload(fn);
|
2004-05-24 22:25:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-04 19:44:56 +02:00
|
|
|
static FAMConnection fc;
|
|
|
|
static bool initialized;
|
2004-05-24 22:25:48 +02:00
|
|
|
|
|
|
|
|
2004-06-04 19:44:56 +02:00
|
|
|
int res_watch_dir(const char* const dir)
|
|
|
|
{
|
|
|
|
if(!initialized)
|
|
|
|
{
|
|
|
|
CHECK_ERR(FAMOpen2(&fc, "lib_res"));
|
|
|
|
atexit2(FAMClose, (uintptr_t)&fc);
|
|
|
|
initialized = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int res_reload_changed_files()
|
|
|
|
{
|
|
|
|
if(!initialized)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
FAMEvent e;
|
|
|
|
while(FAMPending(&fc) > 0)
|
|
|
|
if(FAMNextEvent(&fc, &e) == 0)
|
|
|
|
{
|
|
|
|
const char* sys_fn = e.filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-05-24 22:25:48 +02:00
|
|
|
|
|
|
|
// purpose of this routine (intended to be called once a frame):
|
|
|
|
// file notification may come at any time. by forcing the reloads
|
2004-06-02 17:31:55 +02:00
|
|
|
// to take place here, we don't require everything to be thread-safe.
|