summaryrefslogtreecommitdiff
path: root/shared/checkExist.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:06 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:06 +0200
commitfbe76102e941b9f1edaf236788e42678f05fdf9a (patch)
treef5f538316019fa89be8dc478103490c3a826f3ac /shared/checkExist.cpp
parent3.8 (diff)
downloadFreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.gz
FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.tar.bz2
FreeFileSync-fbe76102e941b9f1edaf236788e42678f05fdf9a.zip
3.9
Diffstat (limited to 'shared/checkExist.cpp')
-rw-r--r--shared/checkExist.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/shared/checkExist.cpp b/shared/checkExist.cpp
deleted file mode 100644
index 3f71afb8..00000000
--- a/shared/checkExist.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "checkExist.h"
-#include "parallelCall.h"
-#include "fileHandling.h"
-
-
-namespace
-{
-template <bool (*testExist)(const Zstring&)>
-class CheckObjectExists : public Async::Procedure
-{
-public:
- CheckObjectExists(const Zstring& filename) :
- filename_(filename.c_str()), //deep copy: worker thread may run longer than main! Avoid shared data
- isExisting(false) {}
-
- virtual void doWork()
- {
- isExisting = testExist(filename_); //throw()
- }
-
- bool doesExist() const //retrieve result
- {
- return isExisting;
- }
-
-private:
- const Zstring filename_; //no reference, lifetime not known
- bool isExisting;
-};
-
-
-template <bool (*testExist)(const Zstring&)>
-inline
-Utility::ResultExist objExists(const Zstring& filename, size_t timeout) //timeout in ms
-{
- typedef CheckObjectExists<testExist> CheckObjEx;
- boost::shared_ptr<CheckObjEx> proc(new CheckObjEx(filename));
-
- return Async::execute(proc, timeout) == Async::TIMEOUT ? Utility::EXISTING_TIMEOUT :
- (proc->doesExist() ? Utility::EXISTING_TRUE : Utility::EXISTING_FALSE);
-}
-}
-
-
-Utility::ResultExist Utility::fileExists(const Zstring& filename, size_t timeout) //timeout in ms
-{
- return objExists<FreeFileSync::fileExists>(filename, timeout);
-}
-
-
-Utility::ResultExist Utility::dirExists(const Zstring& dirname, size_t timeout) //timeout in ms
-{
- return objExists<FreeFileSync::dirExists>(dirname, timeout);
-}
bgstack15