static string getExecutablePath(const Executables::game_exe_t* const exe) { const string& exe_path = exe->path; #ifdef __WXOSX_MAC__ if (exe_path.EndsWith(".app")) { wxCFRef<CFStringRef> cf_path(CFStringCreateWithCString(kCFAllocatorDefault, exe_path.utf8_str(), kCFStringEncodingUTF8)); if (NULL != cf_path) { wxCFRef<CFURLRef> cf_path_url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cf_path, kCFURLPOSIXPathStyle, true)); if (NULL != cf_path_url) { wxCFRef<CFBundleRef> cf_bundle(CFBundleCreate(0, cf_path_url)); if (NULL != cf_bundle) { const wxStandardPathsCF paths(cf_bundle); return paths.GetExecutablePath(); } } } } #endif // __WXOSX_MAC__ return exe_path; }
bool WiresharkApplication::event(QEvent *event) { QString display_filter = NULL; if (event->type() == QEvent::FileOpen) { QFileOpenEvent *foe = static_cast<QFileOpenEvent *>(event); if (foe && foe->file().length() > 0) { QString cf_path(foe->file()); if (initialized_) { emit openCaptureFile(cf_path, display_filter, WTAP_TYPE_AUTO); } else { pending_open_files_.append(cf_path); } } return true; } return QApplication::event(event); }