initial code using FAM API. unfinished; one problem remaining is how to convert absolute paths to their VFS equivalent
This was SVN commit r400.
This commit is contained in:
parent
0ca334ed39
commit
7b9e881039
@ -2,14 +2,53 @@
|
||||
|
||||
#include "res.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "sysdep/win/wfam.h"
|
||||
#else
|
||||
#include <fam.h>
|
||||
#endif
|
||||
|
||||
|
||||
int res_reload(const char* const fn)
|
||||
{
|
||||
return h_reload(fn);
|
||||
}
|
||||
|
||||
|
||||
static FAMConnection fc;
|
||||
static bool initialized;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// purpose of this routine (intended to be called once a frame):
|
||||
// file notification may come at any time. by forcing the reloads
|
||||
|
@ -3,7 +3,10 @@
|
||||
#include "res/tex.h"
|
||||
#include "res/mem.h"
|
||||
#include "res/font.h"
|
||||
#include "res/file.h"
|
||||
#include "res/zip.h"
|
||||
|
||||
|
||||
extern int res_reload(const char* fn);
|
||||
|
||||
extern int res_watch_dir(const char* dir);
|
||||
|
||||
extern int res_reload_changed_files();
|
Loading…
Reference in New Issue
Block a user