• Stars
    star
    123
  • Rank 290,145 (Top 6 %)
  • Language
    C++
  • Created about 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

File / directory watcher for c++11 and boost

Watchdog

Watchdog is a tiny header only library that allows to watch files or directories. It is supposed to be compatible with any application that supports c++11 and uses boost and/or cinder.

Watchdog is currently a work-in-progress.

By default watchdog is disabled in release mode and will only execute the provided callback once when wd::watch is called and do nothing for the other methods. Undef WATCHDOG_ONLY_IN_DEBUG if you want Watchdog to work in release mode.

For the moment non-Cinder application will have their callbacks called in a separated thread!

The API is very small an only expose those 4 functions to watch, unwatch or touch files or directories:

wd::watch( const fs::path &path, const std::function<void(const fs::path&)> &callback );
wd::unwatch( const fs::path &path );
wd::unwatchAll();
wd::touch();

You can use a wildcard character to only watch for the desired files in a directory :

wd::watch( "shaders/lighting.*", []( const fs::path &path ){
	// do something
} );

If you need to be able to iterate through a watched directory you can change the callback signature to this :

wd::watch( "images/*.png", []( const vector<fs::path> &paths ){
	for( auto p : paths ){
		cout << p << " has changed" << endl;
	}
} );

In the context of cinder both absolute path and path relative to the asset folder are accepted.

There's is also a method to update the last write time of a file or directory which is usefull if you want to force the update of some files:

wd::watch( "shaders/include/*", []( const fs::path &path ){
	// this will trigger any watched asset callback in "shaders"
	wd::touch( "shaders" );
} );
wd::watch( "shaders/lighting.*", []( const fs::path &path ){
	// triggered on changes any from "lighting.*" and "include/*"
} );
wd::watch( "shaders/wireframe.*", []( const fs::path &path ){
	// triggered on changes any from "wireframe.*" and "include/*"
} );
License

Copyright (c) 2014, Simon Geilfus All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

More Repositories

1

Cinder-Experiments

A collection of experiments, samples and other bits of code.
C++
231
star
2

Cinder-ImGui

Dear ImGui Renderer/Wrapper for Cinder
C++
156
star
3

SimplexNoise

Collection of Simplex Noise functions
C++
127
star
4

GroveApp

C++
101
star
5

Cinder-Runtime

Runtime-Compiled C++ for Cinder
C++
57
star
6

FlyingTokyo19

Cinder C++ Workshop at Rhizomatiks - FlyingTokyo19 - May 2016
C++
57
star
7

SpacePartitioning

A collection of Space Partitioning Algorithms for Cinder
C++
45
star
8

Cinder-CodeEditor

In-App full-featured Code Editor
JavaScript
25
star
9

Cinder-OculusRift

HMD Camera setup and lense distortion for the Oculus Rift.
C++
24
star
10

Cinder-AssetManager

Supports hot reloading and asynchronous loading of assets (Replaced by https://github.com/simongeilfus/Watchdog)
C++
19
star
11

Cinder-Cereal

Add serialization support for Cinder's classes.
C++
17
star
12

HalfEdge

Work in progress Half-Edge mesh library
C++
16
star
13

Cinder-Cmft

Thin wrapper around Cmft for use with Cinder
C++
12
star
14

SharedMemoryUtils

C++
11
star
15

Cinder-Angelscript

Thin cinder wrapper around Angelscript
C++
10
star
16

PoissonDiskDistribution

C++
9
star
17

Cinder-SLB

Lua Scripting for Cinder ( Wrap SLB and luaGL )
C
8
star
18

CinderAndScriptsClass

C++
8
star
19

Triangulation

C++
7
star
20

Cinder-LiveAssetManager

New block here : https://github.com/simongeilfus/Cinder-AssetManager
C++
7
star
21

FontAwesomeCpp

Helper and generator classes to ease the use of FontAwesome in c++.
C++
7
star
22

Paleodictyon-Gwen-Wrapper

C++
6
star
23

Cinder-Chipmunk

Basic OO Chipmunk wrapper for Cinder.
Objective-C
5
star
24

Cinder-Gx

C++
5
star
25

Cinder-Qhull

Qhull block for Cinder
C
4
star
26

Cinder-GlslProgHelper

Adds preprocessor features to Cinder::GlslProg ( #include, #define, etc... )
C++
3
star
27

Cinder-Gizmo

Basic 3D manipulation library for Cinder.
C++
2
star
28

Cinder-OpenMesh

OpenMesh library
C++
2
star
29

Cinder-Shader

Small addition to Cinder's Glsl Shaders. Allow attrib location binding, transform feedback and auto reloading while you edit the code.
C++
2
star
30

project_starter_kit

c++ project starter kit
C++
1
star
31

Cinder-Gwen-1

Gwen (GUI Without Extravagant Nonsense) for Cinder
C++
1
star
32

Clang-Parser

C++
1
star
33

CinderCMakeBoilerplate

Basic project structure and tools for working with Cinder and CMake
CMake
1
star
34

LuaBindings

Sources for Cinder-LuaBind / libLuaBindings.a
C++
1
star
35

NvidiaEnablement

One-liner block for Cinder to force enable Nvidia Optimus on windows laptops
C
1
star