Tweaked the way we load plugins and launch the app to support symlink'd plugins.

This commit is contained in:
Casey Langen 2016-11-08 15:15:36 -08:00
parent d04b990530
commit ce07e71169
6 changed files with 27 additions and 10 deletions

2
.gitignore vendored
View File

@ -16,9 +16,9 @@ build
src/3rdparty/bin src/3rdparty/bin
src/3rdparty/obj src/3rdparty/obj
src/core/obj src/core/obj
src/square/obj
src/contrib/oggdecoder/obj src/contrib/oggdecoder/obj
src/contrib/waveout/obj src/contrib/waveout/obj
src/contrib/taglib_plugin/obj src/contrib/taglib_plugin/obj
src/contrib/taglib_plugin/taglib-1.11 src/contrib/taglib_plugin/taglib-1.11
src/musikbox/musikbox.in
taglib-prefix taglib-prefix

View File

@ -137,6 +137,12 @@ install(
DESTINATION include/musikcube/core/sdk DESTINATION include/musikcube/core/sdk
) )
# symlink the binary # shell script that starts the app.
install(CODE "EXECUTE_PROCESS (COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/bin/)") install(
install(CODE "EXECUTE_PROCESS (COMMAND ln -sf ${CMAKE_INSTALL_PREFIX}/share/musikcube/musikbox ${CMAKE_INSTALL_PREFIX}/bin/)") FILES src/musikbox/musikbox
DESTINATION bin/
PERMISSIONS
OWNER_EXECUTE OWNER_READ OWNER_WRITE
GROUP_EXECUTE GROUP_READ GROUP_WRITE
WORLD_EXECUTE WORLD_READ
)

View File

@ -71,9 +71,7 @@ std::string musik::core::GetApplicationDirectory() {
char pathbuf[PATH_MAX + 1]; char pathbuf[PATH_MAX + 1];
uint32_t bufsize = sizeof(pathbuf); uint32_t bufsize = sizeof(pathbuf);
_NSGetExecutablePath(pathbuf, &bufsize); _NSGetExecutablePath(pathbuf, &bufsize);
char *resolved = realpath(pathbuf, NULL); result.assign(pathbuf);
result.assign(resolved);
free(resolved);
size_t last = result.find_last_of("/"); size_t last = result.find_last_of("/");
result = result.substr(0, last); /* remove filename component */ result = result.substr(0, last); /* remove filename component */
#else #else

View File

@ -51,6 +51,14 @@ set (BOX_SRCS
./cursespp/Window.cpp ./cursespp/Window.cpp
) )
set(musikbox_INSTALL_DIR ${HOMEBREW_PREFIX})
if (NOT DEFINED musikbox_INSTALL_DIR)
set(musikbox_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()
configure_file("musikbox.in" "musikbox" @ONLY)
add_executable(musikbox ${BOX_SRCS}) add_executable(musikbox ${BOX_SRCS})
if (CMAKE_SYSTEM_NAME MATCHES "Linux") if (CMAKE_SYSTEM_NAME MATCHES "Linux")

View File

@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION "0.3.2" #define VERSION "0.3.3"

5
src/musikbox/musikbox Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pushd /usr/local/share/musikcube/ > /dev/null
{
./musikbox && popd
} || popd > /dev/null