summaryrefslogtreecommitdiff
path: root/RealtimeSync/tray_menu.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:14:37 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:14:37 +0200
commit8bf668665b107469086f16cb8ad23e47d479d2b4 (patch)
tree66a91ef06a8caa7cd6819dcbe1860693d3eda8d5 /RealtimeSync/tray_menu.cpp
parent3.21 (diff)
downloadFreeFileSync-8bf668665b107469086f16cb8ad23e47d479d2b4.tar.gz
FreeFileSync-8bf668665b107469086f16cb8ad23e47d479d2b4.tar.bz2
FreeFileSync-8bf668665b107469086f16cb8ad23e47d479d2b4.zip
4.0
Diffstat (limited to 'RealtimeSync/tray_menu.cpp')
-rw-r--r--RealtimeSync/tray_menu.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/RealtimeSync/tray_menu.cpp b/RealtimeSync/tray_menu.cpp
index 98c66cb5..cbdf6070 100644
--- a/RealtimeSync/tray_menu.cpp
+++ b/RealtimeSync/tray_menu.cpp
@@ -227,7 +227,7 @@ std::vector<Zstring> convert(const std::vector<wxString>& dirList)
{
std::set<Zstring, LessFilename> output;
std::transform(dirList.begin(), dirList.end(),
- std::inserter(output, output.end()), [](const wxString& str) { return zen::toZ(str); });
+ std::inserter(output, output.end()), [](const wxString & str) { return zen::toZ(str); });
return std::vector<Zstring>(output.begin(), output.end());
}
}
@@ -291,15 +291,16 @@ watcher.h (low level wait for directory changes)
rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig& config, const wxString& jobname)
{
- const std::vector<Zstring> dirList = convert(config.directories);
+ Zstring lastFileChanged;
+ const std::vector<Zstring> dirList = convert(config.directories);
try
{
WaitCallbackImpl callback(jobname);
if (config.commandline.empty())
{
- std::wstring errorMsg = _("Invalid commandline: %x");
+ std::wstring errorMsg = _("Invalid command line: %x");
replace(errorMsg, L"%x", L"\"" + config.commandline + L"\"");
throw FileError(errorMsg);
}
@@ -310,6 +311,8 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig&
while (true)
{
+ ::wxSetEnv(L"changed_file", utf8CvrtTo<wxString>(lastFileChanged)); //some way to output what file changed to the user
+
//execute command
zen::shellExecute(config.commandline, zen::EXEC_TYPE_SYNC);
@@ -322,7 +325,8 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig&
while (true)
{
//wait for changes (and for all directories to become available)
- switch (waitForChanges(dirList, &callback))
+ WaitResult res = waitForChanges(dirList, &callback);
+ switch (res.type)
{
case CHANGE_DIR_MISSING: //don't execute the commandline before all directories are available!
callback.scheduleNextSync(std::numeric_limits<long>::max()); //next sync not scheduled (yet)
@@ -331,6 +335,7 @@ rts::MonitorResponse rts::startDirectoryMonitor(const xmlAccess::XmlRealConfig&
callback.notifyAllDirectoriesExist();
break;
case CHANGE_DETECTED:
+ lastFileChanged = res.filename;
break;
}
bgstack15