This commit is contained in:
Elia Zammuto
2021-05-17 21:30:03 +02:00
parent 03236a50e5
commit fe08c241ec
2 changed files with 7 additions and 8 deletions
+2
View File
@@ -27,6 +27,7 @@ if(WIN32)
set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows") set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows")
endif() endif()
add_compile_definitions(SUNSHINE_PLATFORM="windows")
add_subdirectory(tools) #This is temporary, only tools for Windows are needed, for now add_subdirectory(tools) #This is temporary, only tools for Windows are needed, for now
list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_windows.json") list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_windows.json")
@@ -82,6 +83,7 @@ if(WIN32)
set_source_files_properties(ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650") set_source_files_properties(ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650")
set_source_files_properties(ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess") set_source_files_properties(ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess")
else() else()
add_compile_definitions(SUNSHINE_PLATFORM="linux")
list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_linux.json") list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_linux.json")
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
+5 -8
View File
@@ -181,7 +181,7 @@ void deleteApp(resp_https_t response, req_https_t request)
pt::ptree fileTree; pt::ptree fileTree;
try try
{ {
pt::read_json(SUNSHINE_ASSETS_DIR "/" APPS_JSON, fileTree); pt::read_json(config::stream.file_apps, fileTree);
auto &apps_node = fileTree.get_child("apps"s); auto &apps_node = fileTree.get_child("apps"s);
int index = stoi(request->path_match[1]); int index = stoi(request->path_match[1]);
BOOST_LOG(info) << index; BOOST_LOG(info) << index;
@@ -193,7 +193,7 @@ void deleteApp(resp_https_t response, req_https_t request)
} }
else else
{ {
//Unfortuantely Boost PT does not allow to directly edit the array, copt should do the trick //Unfortuantely Boost PT does not allow to directly edit the array, copy should do the trick
pt::ptree newApps; pt::ptree newApps;
int i = 0; int i = 0;
for (const auto &kv : apps_node) for (const auto &kv : apps_node)
@@ -232,11 +232,7 @@ void getConfig(resp_https_t response, req_https_t request)
try try
{ {
outputTree.put("status","true"); outputTree.put("status","true");
#ifdef _WIN32 outputTree.put("platform",SUNSHINE_PLATFORM);
outputTree.put("platform","windows");
#elif
outputTree.put("platform","linux");
#endif
const char *config_file = SUNSHINE_ASSETS_DIR "/sunshine.conf"; const char *config_file = SUNSHINE_ASSETS_DIR "/sunshine.conf";
std::ifstream in { config_file }; std::ifstream in { config_file };
@@ -263,7 +259,8 @@ void getConfig(resp_https_t response, req_https_t request)
} }
} }
void saveConfig(resp_https_t response, req_https_t request){ void saveConfig(resp_https_t response, req_https_t request)
{
std::stringstream ss; std::stringstream ss;
std::stringstream configStream; std::stringstream configStream;
ss << request->content.rdbuf(); ss << request->content.rdbuf();