watchdir arg
This commit is contained in:
parent
ac1bf1cda2
commit
3d7af70bc8
@ -174,7 +174,8 @@ void do_sync_render(std::string fileToRender)
|
|||||||
|
|
||||||
// 2. Setup the output path using a relative path that goes OUTSIDE 'test'
|
// 2. Setup the output path using a relative path that goes OUTSIDE 'test'
|
||||||
dl::bella_sdk::Node pathNode = engine.scene().createNode("outputImagePath");
|
dl::bella_sdk::Node pathNode = engine.scene().createNode("outputImagePath");
|
||||||
pathNode["dir"] = dl::String(".");
|
pathNode["dir"] = dl::String(directory_path.c_str());
|
||||||
|
//pathNode["dir"] = dl::String(".");
|
||||||
pathNode["name"] = dl::String("render_result");
|
pathNode["name"] = dl::String("render_result");
|
||||||
pathNode["ext"] = dl::String(".png");
|
pathNode["ext"] = dl::String(".png");
|
||||||
|
|
||||||
@ -314,7 +315,10 @@ void flip_image_vertically(unsigned char* data, int width, int height, int chann
|
|||||||
delete[] temp_row;
|
delete[] temp_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char** argv ) {
|
//int main( int argc, char** argv ) {
|
||||||
|
#include "dl_core/dl_main.inl"
|
||||||
|
#include "dl_core/dl_args.h"
|
||||||
|
int DL_main(dl::Args& args) {
|
||||||
signal( SIGABRT, sigend );
|
signal( SIGABRT, sigend );
|
||||||
signal( SIGINT, sigend );
|
signal( SIGINT, sigend );
|
||||||
signal( SIGTERM, sigend );
|
signal( SIGTERM, sigend );
|
||||||
@ -328,7 +332,9 @@ int main( int argc, char** argv ) {
|
|||||||
bool useGeneric = false;
|
bool useGeneric = false;
|
||||||
std::string path;
|
std::string path;
|
||||||
|
|
||||||
if ( argc >= 2 ) {
|
args.add("wd", "watchdir", "", "mode file watch");
|
||||||
|
|
||||||
|
/*if (argc >= 2) {
|
||||||
path = std::string( argv[1] );
|
path = std::string( argv[1] );
|
||||||
|
|
||||||
if ( efsw::FileSystem::isDirectory( path ) ) {
|
if ( efsw::FileSystem::isDirectory( path ) ) {
|
||||||
@ -340,6 +346,15 @@ int main( int argc, char** argv ) {
|
|||||||
useGeneric = true;
|
useGeneric = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
//std::cout << "args: " << args. << std::endl;
|
||||||
|
if (args.have("--watchdir")) {
|
||||||
|
path = args.value("--watchdir").buf();
|
||||||
|
std::cout << "Watching path: " << path << std::endl;
|
||||||
|
if (efsw::FileSystem::isDirectory(path)) {
|
||||||
|
commonTest = false;
|
||||||
|
useGeneric = true; // Force generic for testing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateListener* ul = new UpdateListener();
|
UpdateListener* ul = new UpdateListener();
|
||||||
@ -350,6 +365,7 @@ int main( int argc, char** argv ) {
|
|||||||
fileWatcher.followSymlinks( false );
|
fileWatcher.followSymlinks( false );
|
||||||
fileWatcher.allowOutOfScopeLinks( false );
|
fileWatcher.allowOutOfScopeLinks( false );
|
||||||
|
|
||||||
|
std::cout << "commonTest: " << commonTest << std::endl;
|
||||||
if ( commonTest ) {
|
if ( commonTest ) {
|
||||||
std::string CurPath( efsw::System::getProcessPath() );
|
std::string CurPath( efsw::System::getProcessPath() );
|
||||||
|
|
||||||
@ -364,9 +380,10 @@ int main( int argc, char** argv ) {
|
|||||||
} else {
|
} else {
|
||||||
if ( fileWatcher.addWatch( path, ul, true ) > 0 ) {
|
if ( fileWatcher.addWatch( path, ul, true ) > 0 ) {
|
||||||
fileWatcher.watch();
|
fileWatcher.watch();
|
||||||
|
/// add a watch to the system
|
||||||
|
handleWatchID(fileWatcher.addWatch(path, ul, true));
|
||||||
std::cout << "Watching directory: " << path.c_str() << std::endl;
|
std::cout << "Watching directory: " << path.c_str() << std::endl;
|
||||||
|
directory_path = path;
|
||||||
if ( useGeneric ) {
|
if ( useGeneric ) {
|
||||||
std::cout << "Using generic backend watcher" << std::endl;
|
std::cout << "Using generic backend watcher" << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user