diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:16:21 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:16:21 +0200 |
commit | 88a2d0007db222c339f0b6a17794a2014a241892 (patch) | |
tree | 75105ef49b3a52b7ee176a1ad480e7652e49825f /lib/dir_lock.cpp | |
parent | 4.2 (diff) | |
download | FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.gz FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.tar.bz2 FreeFileSync-88a2d0007db222c339f0b6a17794a2014a241892.zip |
4.3
Diffstat (limited to 'lib/dir_lock.cpp')
-rw-r--r-- | lib/dir_lock.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/dir_lock.cpp b/lib/dir_lock.cpp index 735fd7b6..ab3c84ea 100644 --- a/lib/dir_lock.cpp +++ b/lib/dir_lock.cpp @@ -74,10 +74,10 @@ public: //ATTENTION: setting file pointer IS required! => use CreateFile/FILE_GENERIC_WRITE + SetFilePointerEx! //although CreateFile/FILE_APPEND_DATA without SetFilePointerEx works locally, it MAY NOT work on some network shares creating a 4 gig file!!! - const HANDLE fileHandle = ::CreateFile(applyLongPathPrefix(lockfilename_.c_str()).c_str(), + const HANDLE fileHandle = ::CreateFile(applyLongPathPrefix(lockfilename_).c_str(), GENERIC_READ | GENERIC_WRITE, //use both when writing over network, see comment in file_io.cpp FILE_SHARE_READ, - 0, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); @@ -340,8 +340,8 @@ std::string retrieveLockId(const Zstring& lockfilename) //throw FileError, Error void waitOnDirLock(const Zstring& lockfilename, DirLockCallback* callback) //throw FileError { - std::wstring infoMsg = _("Waiting while directory is locked (%x)..."); - replace(infoMsg, L"%x", std::wstring(L"\"") + lockfilename + L"\""); + const std::wstring infoMsg = replaceCpy(_("Waiting while directory is locked (%x)..."), L"%x", std::wstring(L"\"") + lockfilename + L"\""); + if (callback) callback->reportInfo(infoMsg); //--------------------------------------------------------------- @@ -408,8 +408,8 @@ void waitOnDirLock(const Zstring& lockfilename, DirLockCallback* callback) //thr long remainingSeconds = ((DETECT_EXITUS_INTERVAL - (wxGetLocalTimeMillis() - lockSilentStart)) / 1000).ToLong(); remainingSeconds = std::max(0L, remainingSeconds); - std::wstring remSecMsg = _P("1 sec", "%x sec", remainingSeconds); - replace(remSecMsg, L"%x", toString<std::wstring>(remainingSeconds)); + const std::wstring remSecMsg = replaceCpy(_P("1 sec", "%x sec", remainingSeconds), L"%x", toString<std::wstring>(remainingSeconds)); + callback->reportInfo(infoMsg + L" " + remSecMsg); } else @@ -441,7 +441,7 @@ bool tryLock(const Zstring& lockfilename) //throw FileError const HANDLE fileHandle = ::CreateFile(applyLongPathPrefix(lockfilename).c_str(), GENERIC_READ | GENERIC_WRITE, //use both when writing over network, see comment in file_io.cpp FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - 0, + NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); @@ -472,7 +472,7 @@ bool tryLock(const Zstring& lockfilename) //throw FileError ::close(fileHandle); #endif - zen::ScopeGuard guardLockFile = zen::makeGuard([&]() { zen::removeFile(lockfilename); }); + ScopeGuard guardLockFile = zen::makeGuard([&] { zen::removeFile(lockfilename); }); //write UUID at the beginning of the file: this ID is a universal identifier for this lock (no matter what the path is, considering symlinks, etc.) writeLockInfo(lockfilename); //throw FileError |