Ttolerate inability to permission the Wi-Fi P2P configuration file when debugging.

This commit is contained in:
Robin Davies
2024-09-05 13:29:44 -04:00
parent 80f49d853a
commit 9534d3dc41
2 changed files with 19 additions and 13 deletions
+6
View File
@@ -201,6 +201,8 @@ static void openWithPerms(
std::filesystem::perms::group_read | std::filesystem::perms::group_write) std::filesystem::perms::group_read | std::filesystem::perms::group_write)
{ {
auto directory = path.parent_path(); auto directory = path.parent_path();
if (!std::filesystem::exists(directory))
{
std::filesystem::create_directories(directory); std::filesystem::create_directories(directory);
// open and close to make an existing empty file. // open and close to make an existing empty file.
// close it. // close it.
@@ -209,11 +211,15 @@ static void openWithPerms(
f.open(path); f.open(path);
f.close(); f.close();
} }
try {
// set the perms. // set the perms.
std::filesystem::permissions( std::filesystem::permissions(
path, path,
perms, perms,
std::filesystem::perm_options::replace); std::filesystem::perm_options::replace);
} catch (const std::exception&) {
}
}
// open for re3al. // open for re3al.
f.open(path); f.open(path);
+2 -2
View File
@@ -25,7 +25,7 @@
#pragma once #pragma once
#define DEVICE_GUID_FILE "/etc/pipedal/config/device_uuid" #define DEVICE_GUID_FILE "/var/pipedal/config/device_uuid"
#define PIPEDAL_P2PD_CONF_PATH "/etc/pipedal/config/pipedal_p2pd.conf" #define PIPEDAL_P2PD_CONF_PATH "/var/pipedal/config/pipedal_p2pd.conf"