diff --git a/.gitignore b/.gitignore index 1905f775365443b9cd482978b1b5a957bcca0c8d..5baa3330c50b38103263d8386a09a90319cacf48 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ *.out *.app Application/build/ +Application/tmp/ diff --git a/Application/src/commons/common/file/Path.cpp b/Application/src/commons/common/file/Path.cpp index 7cb43e2fbc10f2be49afa3e50c11c70f5619f538..bb21c5ee284c16170427509b5de6fa37ad31ad42 100644 --- a/Application/src/commons/common/file/Path.cpp +++ b/Application/src/commons/common/file/Path.cpp @@ -1,4 +1,5 @@ #include "Path.h" +#include <cstdlib> #if WIN32 #include "../dirent.h" #define OS_SEP '\\' @@ -161,8 +162,7 @@ namespace file { #if WIN32 if (!folder.empty() && folder.back() == ':') continue; - - if(_mkdir(folder.c_str()) != 0) { + if(CreateDirectory(folder.c_str(), NULL)) { #else if(mkdir(folder.c_str(), ACCESSPERMS) != 0) { #endif @@ -231,8 +231,11 @@ namespace file { U_EXCEPTION("Unknown file type '%S'.", &file.str()); } } - +#if defined(WIN32) + return RemoveDirectory(str().c_str()); +#else return rmdir(str().c_str()) == 0; +#endif } bool valid_extension(const file::Path& path, const std::string& filter_extension) { diff --git a/Application/src/commons/common/misc/CommandLine.cpp b/Application/src/commons/common/misc/CommandLine.cpp index e452191288285b3fb63d84d421502431bbf72ad0..66355899d1ab8df1a8bab0f257f76c1381eaba54 100644 --- a/Application/src/commons/common/misc/CommandLine.cpp +++ b/Application/src/commons/common/misc/CommandLine.cpp @@ -128,7 +128,11 @@ namespace cmn { } void CommandLine::cd_home() { +#if defined(WIN32) + if(SetCurrentDirectoryA(_wd.c_str())) +#else if (chdir(_wd.str().c_str())) +#endif //Debug("Changed directory to '%S'.", &_wd.str()); //else Error("Cannot change directory to '%S'.", &_wd.str()); diff --git a/Application/src/grabber/grabber.cpp b/Application/src/grabber/grabber.cpp index 12ec77c9df6c485084a8ee28659812390a2b1a81..318570aa3e65d557005f9c8643c12ad2e344c27a 100644 --- a/Application/src/grabber/grabber.cpp +++ b/Application/src/grabber/grabber.cpp @@ -701,7 +701,7 @@ void FrameGrabber::initialize_video() { } if(filenames.size() == 1) { - _video = new VideoSource(filenames.front()); + _video = new VideoSource(filenames.front().str()); } else { _video = new VideoSource(filenames); @@ -725,11 +725,7 @@ void FrameGrabber::initialize_video() { if(!SETTING(mask_path).value<file::Path>().empty()) { auto path = pv::DataLocation::parse("input", SETTING(mask_path).value<file::Path>()); if(path.exists()) { - auto folder = path.remove_filename(); - auto ext = path.extension().to_string(); - auto base = path.remove_extension(); - - _video_mask = new VideoSource(base.str(), ext); + _video_mask = new VideoSource(path.str()); } }