From 279a5b4f32ebd9ed9df4390995e4bfc4da38f1df Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 3 Jun 2011 12:08:37 +0200 Subject: BACKENDS: Add OSystem::displayLogFile interface + OSX implementation --- backends/platform/sdl/macosx/macosx.cpp | 24 ++++++++++++++++++++++++ backends/platform/sdl/macosx/macosx.h | 4 ++++ 2 files changed, 28 insertions(+) (limited to 'backends/platform/sdl/macosx') diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp index 0ef16d9a6e..0624de2146 100644 --- a/backends/platform/sdl/macosx/macosx.cpp +++ b/backends/platform/sdl/macosx/macosx.cpp @@ -34,6 +34,7 @@ #include "common/fs.h" #include "CoreFoundation/CoreFoundation.h" +#include "CoreServices/CoreServices.h" OSystem_MacOSX::OSystem_MacOSX() : @@ -75,4 +76,27 @@ void OSystem_MacOSX::setupIcon() { // Don't set icon on OS X, as we use a nicer external icon there. } +bool OSystem_MacOSX::hasFeature(Feature f) { + if (f == kFeatureDisplayLogFile) + return true; + return OSystem_POSIX::hasFeature(f); +} + +bool OSystem_MacOSX::displayLogFile() { + // Use LaunchServices to open the log file, if possible. + + if (_logFilePath.empty()) + return false; + + FSRef ref; + OSStatus err; + + err = FSPathMakeRef((const UInt8 *)_logFilePath.c_str(), &ref, NULL); + if (err == noErr) { + err = LSOpenFSRef(&ref, NULL); + } + + return err != noErr; +} + #endif diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h index 6d78427522..86c70297ec 100644 --- a/backends/platform/sdl/macosx/macosx.h +++ b/backends/platform/sdl/macosx/macosx.h @@ -29,6 +29,10 @@ class OSystem_MacOSX : public OSystem_POSIX { public: OSystem_MacOSX(); + virtual bool hasFeature(Feature f); + + virtual bool displayLogFile(); + virtual void initBackend(); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); virtual void setupIcon(); -- cgit v1.2.3