mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-03-28 19:20:26 +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"]
|
||||
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"]
|
||||
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(OpenSSL REQUIRED)
|
||||
find_package(FFmpeg REQUIRED)
|
||||
|
||||
#FIXME: libX11 is Linux only
|
||||
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)
|
||||
if("x${BUILD_TYPE}" STREQUAL "xDEBUG")
|
||||
list(APPEND SUNSHINE_COMPILE_OPTIONS -O0 -pedantic -ggdb3)
|
||||
@ -80,7 +82,6 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
pulse
|
||||
pulse-simple
|
||||
|
||||
#libpulse should be found with package_find
|
||||
opus)
|
||||
|
||||
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.
|
||||
//
|
||||
|
||||
#include "nvhttp.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
@ -19,6 +18,8 @@
|
||||
#include "config.h"
|
||||
#include "utility.h"
|
||||
#include "stream.h"
|
||||
#include "nvhttp.h"
|
||||
|
||||
|
||||
namespace nvhttp {
|
||||
using namespace std::literals;
|
||||
@ -28,6 +29,7 @@ constexpr auto PORT_HTTPS = 47984;
|
||||
constexpr auto VERSION = "7.1.415.0";
|
||||
constexpr auto GFE_VERSION = "2.0.0.1";
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
std::string read_file(const char *path);
|
||||
@ -91,6 +93,12 @@ void save_devices() {
|
||||
}
|
||||
|
||||
void load_devices() {
|
||||
auto file_devices = fs::current_path() / config::nvhttp.file_devices;
|
||||
|
||||
if(!fs::exists(file_devices)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pt::ptree root;
|
||||
try {
|
||||
pt::read_json(config::nvhttp.file_devices, root);
|
||||
|
Loading…
x
Reference in New Issue
Block a user