mirror of
https://github.com/jellyfin/jellyfin-media-player.git
synced 2025-02-18 12:57:49 +00:00
Possible fix to find the web-client path on Linux
This commit is contained in:
parent
13b78940be
commit
2e6bc031bd
@ -14,4 +14,4 @@ if (NOT BUILD_TARGET STREQUAL "RPI")
|
||||
endif()
|
||||
|
||||
set(INSTALL_BIN_DIR bin)
|
||||
set(INSTALL_RESOURCE_DIR .)
|
||||
set(INSTALL_RESOURCE_DIR share/plexmediaplayer)
|
||||
|
@ -116,7 +116,12 @@ if(WIN32)
|
||||
list(APPEND RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bundle/win/iconres.rc)
|
||||
endif()
|
||||
|
||||
add_resources(TARGET ${MAIN_TARGET} SOURCES ${WEB_CLIENT_DIR} DEST ${INSTALL_RESOURCE_DIR}/web-client-${WEB_CLIENT_VERSTR})
|
||||
set(RESOURCE_ROOT .)
|
||||
if(APPLE)
|
||||
set(RESOURCE_ROOT Resources)
|
||||
endif()
|
||||
|
||||
add_resources(TARGET ${MAIN_TARGET} SOURCES ${WEB_CLIENT_DIR} DEST ${RESOURCE_ROOT}/web-client-${WEB_CLIENT_VERSTR})
|
||||
if(NOT APPLE)
|
||||
install(DIRECTORY ${WEB_CLIENT_DIR} DESTINATION ${INSTALL_RESOURCE_DIR})
|
||||
endif()
|
||||
|
@ -29,16 +29,31 @@ static QDir writableLocation(QStandardPaths::StandardLocation loc)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Try a couple of different strategies to find the file we are looking for.
|
||||
// 1) By looking next to the application binary
|
||||
// 2) By looking in binary/../Resources
|
||||
// 3) By looking in PREFIX/share/plexmediaplayer
|
||||
// 4) By looking in PREFIX/plexmediaplayer
|
||||
//
|
||||
QString Paths::resourceDir(const QString& file)
|
||||
{
|
||||
auto resourceDir = QDir(QGuiApplication::applicationDirPath());
|
||||
auto appResourceDir = QGuiApplication::applicationDirPath() + "/";
|
||||
auto prefixDir = QString(PREFIX);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
resourceDir.cdUp();
|
||||
resourceDir.cd("Resources");
|
||||
#endif
|
||||
QStringList possibleResourceDirs = {
|
||||
appResourceDir,
|
||||
appResourceDir + "../Resources/",
|
||||
prefixDir + "/share/plexmediaplayer/",
|
||||
prefixDir + "/plexmediaplayer/"
|
||||
};
|
||||
|
||||
return resourceDir.filePath(file);
|
||||
for (const auto& fileStr : possibleResourceDirs)
|
||||
{
|
||||
if (QFile::exists(fileStr + file))
|
||||
return fileStr + file;
|
||||
}
|
||||
|
||||
return appResourceDir + file;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user