diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:16 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:16 +0200 |
commit | bd6336c629841c6db3a6ca53a936d629d34db53b (patch) | |
tree | 3721ef997864108df175ce677a8a7d4342a6f1d2 /RealtimeSync/application.cpp | |
parent | 4.0 (diff) | |
download | FreeFileSync-bd6336c629841c6db3a6ca53a936d629d34db53b.tar.gz FreeFileSync-bd6336c629841c6db3a6ca53a936d629d34db53b.tar.bz2 FreeFileSync-bd6336c629841c6db3a6ca53a936d629d34db53b.zip |
4.1
Diffstat (limited to 'RealtimeSync/application.cpp')
-rw-r--r-- | RealtimeSync/application.cpp | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/RealtimeSync/application.cpp b/RealtimeSync/application.cpp index aa1a1385..55c2e9c3 100644 --- a/RealtimeSync/application.cpp +++ b/RealtimeSync/application.cpp @@ -9,17 +9,21 @@ #include <wx/event.h> #include "resources.h" #include <wx/msgdlg.h> -#include "../shared/localization.h" +#include "../lib/localization.h" #include "xml_ffs.h" -#include "../shared/standard_paths.h" +#include "../lib/ffs_paths.h" #include <wx/file.h> -#include "../shared/string_conv.h" +#include <wx+/string_conv.h> #include <wx/log.h> +#include <zen/file_handling.h> #ifdef FFS_LINUX #include <gtk/gtk.h> #endif +using namespace zen; + + IMPLEMENT_APP(Application); bool Application::OnInit() @@ -49,28 +53,32 @@ void Application::OnStartApplication(wxIdleEvent& event) zen::setLanguage(rts::getProgramLanguage()); //try to set config/batch-filename set by %1 parameter - wxString cfgFilename; - if (argc > 1) + std::vector<wxString> commandArgs; + for (int i = 1; i < argc; ++i) { - const wxString filename(argv[1]); - - if (wxFileExists(filename)) //load file specified by %1 parameter: - cfgFilename = filename; - else if (wxFileExists(filename + wxT(".ffs_real"))) - cfgFilename = filename + wxT(".ffs_real"); - else if (wxFileExists(filename + wxT(".ffs_batch"))) - cfgFilename = filename + wxT(".ffs_batch"); - else + Zstring filename = toZ(argv[i]); + + if (!fileExists(filename)) //be a little tolerant { - wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + filename + wxT("\""), _("Error"), wxOK | wxICON_ERROR); - return; + if (fileExists(filename + Zstr(".ffs_real"))) + filename = filename + Zstr(".ffs_real"); + else if (fileExists(filename + Zstr(".ffs_batch"))) + filename = filename + Zstr(".ffs_batch"); + else + { + wxMessageBox(wxString(_("File does not exist:")) + wxT(" \"") + toWx(filename) + wxT("\""), _("Error"), wxOK | wxICON_ERROR); + return; + } } + commandArgs.push_back(toWx(filename)); } - GlobalResources::getInstance().load(); //loads bitmap resources on program startup + wxString cfgFilename; + if (!commandArgs.empty()) + cfgFilename = commandArgs[0]; MainDialog* frame = new MainDialog(NULL, cfgFilename); - frame->SetIcon(*GlobalResources::getInstance().programIcon); //set application icon + frame->SetIcon(GlobalResources::instance().programIcon); //set application icon frame->Show(); } |