From af018f7e4fe90b058d45a8ff803af4dcf759a7ce Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 18 Sep 2013 19:26:26 +0200 Subject: macosx: move bundle path stuff to path-macosx.m This makes the code uniform to how stuff was handled for Windows in 1cb55ceb. --- Makefile | 2 +- mpvcore/path.c | 7 +------ osdep/macosx_bundle.h | 26 -------------------------- osdep/macosx_bundle.m | 30 ------------------------------ osdep/path-macosx.m | 30 ++++++++++++++++++++++++++++++ osdep/path.h | 7 +++++++ 6 files changed, 39 insertions(+), 63 deletions(-) delete mode 100644 osdep/macosx_bundle.h delete mode 100644 osdep/macosx_bundle.m create mode 100644 osdep/path-macosx.m diff --git a/Makefile b/Makefile index 625b4fb58a..927f2501a0 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ SOURCES-$(LIBPOSTPROC) += video/filter/vf_pp.c SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c SOURCES-$(COCOA) += video/out/cocoa_common.m \ - osdep/macosx_bundle.m \ + osdep/path-macosx.m \ osdep/macosx_application.m \ osdep/macosx_events.m \ osdep/ar/HIDRemote.m diff --git a/mpvcore/path.c b/mpvcore/path.c index 73eee15567..647693fb05 100644 --- a/mpvcore/path.c +++ b/mpvcore/path.c @@ -39,16 +39,11 @@ #include "osdep/io.h" #include "osdep/path.h" -#ifdef CONFIG_COCOA -#include "osdep/macosx_bundle.h" -#endif - - typedef char *(*lookup_fun)(const char *); static const lookup_fun config_lookup_functions[] = { mp_find_user_config_file, #ifdef CONFIG_COCOA - get_bundled_path, + mp_get_macosx_bundled_path, #endif mp_find_global_config_file, NULL diff --git a/osdep/macosx_bundle.h b/osdep/macosx_bundle.h deleted file mode 100644 index fbb3383ad5..0000000000 --- a/osdep/macosx_bundle.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPV_MACOSX_BUNDLE -#define MPV_MACOSX_BUNDLE - -// Returns absolute path of a resource file in a Mac OS X application bundle. -char *get_bundled_path(const char *filename); - -#endif /* MPV_MACOSX_BUNDLE */ - diff --git a/osdep/macosx_bundle.m b/osdep/macosx_bundle.m deleted file mode 100644 index 3a1f3b5b0b..0000000000 --- a/osdep/macosx_bundle.m +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of mpv. - * - * mpv is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * mpv is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with mpv; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#import -#include "osdep/macosx_bundle.h" -#include "mpvcore/path.h" - -char *get_bundled_path(const char *file) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSString *path = [[NSBundle mainBundle] resourcePath]; - char *rv = mp_path_join(NULL, bstr0([path UTF8String]), bstr0(file)); - [pool release]; - return rv; -} diff --git a/osdep/path-macosx.m b/osdep/path-macosx.m new file mode 100644 index 0000000000..7446710ee5 --- /dev/null +++ b/osdep/path-macosx.m @@ -0,0 +1,30 @@ +/* + * This file is part of mpv. + * + * mpv is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * mpv is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with mpv; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#import +#include "mpvcore/path.h" +#include "osdep/path.h" + +char *mp_get_macosx_bundled_path(const char *file) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *path = [[NSBundle mainBundle] resourcePath]; + char *rv = mp_path_join(NULL, bstr0([path UTF8String]), bstr0(file)); + [pool release]; + return rv; +} diff --git a/osdep/path.h b/osdep/path.h index 26b8cd344e..0a5091bc3d 100644 --- a/osdep/path.h +++ b/osdep/path.h @@ -1,8 +1,15 @@ #ifndef OSDEP_PATH_H #define OSDEP_PATH_H +#include "config.h" + #ifdef _WIN32 char *mp_get_win_config_path(const char *filename); #endif +#ifdef CONFIG_COCOA +// Returns absolute path of a resource file in a Mac OS X application bundle. +char *mp_get_macosx_bundled_path(const char *filename); +#endif + #endif -- cgit v1.2.3