mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-04-07 13:21:05 +00:00
test for the existance of a file before reading from it
This commit is contained in:
parent
f8d4ae5b84
commit
31c0976e7a
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,6 +1,6 @@
|
|||||||
[submodule "moonlight-common-c"]
|
[submodule "moonlight-common-c"]
|
||||||
path = moonlight-common-c
|
path = moonlight-common-c
|
||||||
url = git@github.com:moonlight-stream/moonlight-common-c.git
|
url = https://github.com/moonlight-stream/moonlight-common-c.git
|
||||||
[submodule "Simple-Web-Server"]
|
[submodule "Simple-Web-Server"]
|
||||||
path = Simple-Web-Server
|
path = Simple-Web-Server
|
||||||
url = git@github.com:loki-47-6F-64/Simple-Web-Server.git
|
url = https://github.com/loki-47-6F-64/Simple-Web-Server.git
|
||||||
|
@ -56,9 +56,11 @@ include_directories(
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
find_package(FFmpeg REQUIRED)
|
find_package(FFmpeg REQUIRED)
|
||||||
|
|
||||||
|
#FIXME: libX11 is Linux only
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
list(APPEND SUNSHINE_COMPILE_OPTIONS -fPIC -Wall -Wno-missing-braces -Wno-maybe-uninitialized)
|
list(APPEND SUNSHINE_COMPILE_OPTIONS -fPIC -Wall -Wno-missing-braces -Wno-maybe-uninitialized -Wno-sign-compare)
|
||||||
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
|
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
|
||||||
if("x${BUILD_TYPE}" STREQUAL "xDEBUG")
|
if("x${BUILD_TYPE}" STREQUAL "xDEBUG")
|
||||||
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3)
|
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3)
|
||||||
@ -80,7 +82,6 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
|||||||
pulse
|
pulse
|
||||||
pulse-simple
|
pulse-simple
|
||||||
|
|
||||||
#libpulse should be found with package_find
|
|
||||||
opus)
|
opus)
|
||||||
|
|
||||||
add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
add_definitions(-DSUNSHINE_ASSETS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/assets")
|
||||||
|
12
nvhttp.cpp
12
nvhttp.cpp
@ -2,9 +2,8 @@
|
|||||||
// Created by loki on 6/3/19.
|
// Created by loki on 6/3/19.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "nvhttp.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/xml_parser.hpp>
|
#include <boost/property_tree/xml_parser.hpp>
|
||||||
@ -19,6 +18,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
|
#include "nvhttp.h"
|
||||||
|
|
||||||
|
|
||||||
namespace nvhttp {
|
namespace nvhttp {
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
@ -28,6 +29,7 @@ constexpr auto PORT_HTTPS = 47984;
|
|||||||
constexpr auto VERSION = "7.1.415.0";
|
constexpr auto VERSION = "7.1.415.0";
|
||||||
constexpr auto GFE_VERSION = "2.0.0.1";
|
constexpr auto GFE_VERSION = "2.0.0.1";
|
||||||
|
|
||||||
|
namespace fs = std::filesystem;
|
||||||
namespace pt = boost::property_tree;
|
namespace pt = boost::property_tree;
|
||||||
|
|
||||||
std::string read_file(const char *path);
|
std::string read_file(const char *path);
|
||||||
@ -91,6 +93,12 @@ void save_devices() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load_devices() {
|
void load_devices() {
|
||||||
|
auto file_devices = fs::current_path() / config::nvhttp.file_devices;
|
||||||
|
|
||||||
|
if(!fs::exists(file_devices)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pt::ptree root;
|
pt::ptree root;
|
||||||
try {
|
try {
|
||||||
pt::read_json(config::nvhttp.file_devices, root);
|
pt::read_json(config::nvhttp.file_devices, root);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user