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
+17 -11
View File
@@ -201,19 +201,25 @@ 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();
std::filesystem::create_directories(directory); if (!std::filesystem::exists(directory))
// open and close to make an existing empty file.
// close it.
{ {
std::ofstream f; std::filesystem::create_directories(directory);
f.open(path); // open and close to make an existing empty file.
f.close(); // close it.
{
std::ofstream f;
f.open(path);
f.close();
}
try {
// set the perms.
std::filesystem::permissions(
path,
perms,
std::filesystem::perm_options::replace);
} catch (const std::exception&) {
}
} }
// set the perms.
std::filesystem::permissions(
path,
perms,
std::filesystem::perm_options::replace);
// 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"