install icons to /usr/share and load them from there

This commit is contained in:
Zion Nimchuk 2018-01-17 22:08:51 -08:00 committed by kd-11
parent 6828fbf658
commit 49e64b9e82
2 changed files with 20 additions and 1 deletions

View File

@ -468,4 +468,9 @@ if(UNIX AND NOT APPLE)
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps)
install(FILES rpcs3.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
# Install other files
install(DIRECTORY ../bin/Icons
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/rpcs3)
install(DIRECTORY ../bin/GuiConfigs
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/rpcs3)
endif()

View File

@ -10,6 +10,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <libgen.h>
#endif
// STB_IMAGE_IMPLEMENTATION and STB_TRUETYPE_IMPLEMENTATION defined externally
@ -470,7 +471,20 @@ namespace rsx
{
//Resource was not found in config dir, try and grab from relative path (linux)
info = std::make_unique<image_info>(("Icons/ui/" + res).c_str());
#ifndef _WIN32
if (info->data == nullptr)
{
char result[ PATH_MAX ];
#ifdef __linux__
ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX );
#else
ssize_t count = readlink( "/proc/curproc/file", result, PATH_MAX );
#endif
std::string executablePath = dirname(result);
info = std::make_unique<image_info>((executablePath + "/../share/rpcs3/Icons/ui/" + res).c_str());
}
#endif
if (info->data != nullptr)
{
//Install the image to config dir
@ -1308,7 +1322,7 @@ namespace rsx
u16 m_elements_height = 0;
s16 m_selected_entry = -1;
u16 m_elements_count = 0;
public:
list_view(u16 width, u16 height)
{