Added check for stremio service

- Check for stremio service to use server.js of stremio service
This commit is contained in:
Zarg 2025-04-14 23:40:05 +02:00
parent 3117065f51
commit 501f616717
4 changed files with 38 additions and 8 deletions

7
.idea/discord.xml Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/stremio-desktop-v5.iml" filepath="$PROJECT_DIR$/.idea/stremio-desktop-v5.iml" />
</modules>
</component>
</project>

View file

@ -55,7 +55,7 @@ const VCPKG_CMAKE = 'C:/bin/vcpkg/scripts/buildsystems/vcpkg.cmake';
fs.mkdirSync(BUILD_DIR, { recursive: true });
}
console.log('\n=== Running CMake in cmake-build-release ===');
console.log(`\n=== Running CMake in cmake-build-${debugBuild ? "Debug" : "Release"} ===`);
process.chdir(BUILD_DIR);
execSync(
`cmake -G Ninja -DCMAKE_BUILD_TYPE=${debugBuild ? "Debug" : "Release"} -DCMAKE_TOOLCHAIN_FILE=${VCPKG_CMAKE} -DVCPKG_TARGET_TRIPLET=${VCPKG_TRIPLET} ..`,

View file

@ -1,5 +1,6 @@
#include "server.h"
#include <windows.h>
#include <shlobj.h>
#include <string>
#include <thread>
#include <atomic>
@ -27,13 +28,27 @@ bool StartNodeServer()
std::wstring exeDir = GetExeDirectory();
std::wstring exePath = exeDir + L"\\stremio-runtime.exe";
std::wstring scriptPath = exeDir + L"\\server.js";
if(!FileExists(exePath)){
AppendToCrashLog(L"[NODE]: Missing stremio-runtime.exe");
return false;
}
if(!FileExists(scriptPath)){
AppendToCrashLog(L"[NODE]: Missing server.js");
return false;
if (!FileExists(exePath) || !FileExists(scriptPath)) {
// Check alternative path in %localappdata%
wchar_t localAppData[MAX_PATH];
if (SUCCEEDED(SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, localAppData))) {
std::wstring altDir = std::wstring(localAppData) + L"\\Programs\\StremioService";
std::wstring altExePath = altDir + L"\\stremio-runtime.exe";
std::wstring altScriptPath = altDir + L"\\server.js";
if (FileExists(altExePath) && FileExists(altScriptPath)) {
exePath = altExePath;
scriptPath = altScriptPath;
exeDir = altDir;
} else {
AppendToCrashLog(L"[NODE]: Missing stremio-runtime.exe and server.js in both exeDir and localappdata.");
return false;
}
} else {
AppendToCrashLog(L"[NODE]: Failed to retrieve local app data path.");
return false;
}
}
if (!g_serverJob) {