예제 #1
0
파일: spion.c 프로젝트: Acconut/spion
void on_change(uv_fs_event_t* handle, const char* filename, int events, int status) {
	char path[1024];
	size_t size = 1023;
	// Does not handle error if path is longer than 1023.
	uv_fs_event_getpath(handle, path, &size);
	path[++size] = '\0';

	goCallback(handle->data, path, filename, events);
}
예제 #2
0
static int luv_fs_event_getpath(lua_State* L) {
  uv_fs_event_t* handle = luv_check_fs_event(L, 1);
  size_t len = 2*PATH_MAX;
  char buf[2*PATH_MAX];
  int ret = uv_fs_event_getpath(handle, buf, &len);
  if (ret < 0) return luv_error(L, ret);
  lua_pushlstring(L, buf, len);
  return 1;
}
예제 #3
0
파일: main.c 프로젝트: FuckWisdom/island
void on_fs_event_cb(uv_fs_event_t *handle, const char *filename, int events, int status)
{
    char path[1024];
    size_t size = 1023;
    // Does not handle error if path is longer than 1023.
    uv_fs_event_getpath(handle, path, &size);
    path[size] = '\0';

    printf("%s is ", filename ? filename : "");
    if (events & UV_RENAME)
        printf("renamed\n");
    if (events & UV_CHANGE)
        printf("changed\n");

    setupModuleResource(path);

    // TODO: so ugly
    checkCudaErrors(cuMemcpyHtoD(d_fragColor, &d_img_content, d_fragColor_bytes));
}