Ttolerate inability to permission the Wi-Fi P2P configuration file when debugging.
This commit is contained in:
@@ -201,19 +201,25 @@ static void openWithPerms(
|
||||
std::filesystem::perms::group_read | std::filesystem::perms::group_write)
|
||||
{
|
||||
auto directory = path.parent_path();
|
||||
std::filesystem::create_directories(directory);
|
||||
// open and close to make an existing empty file.
|
||||
// close it.
|
||||
if (!std::filesystem::exists(directory))
|
||||
{
|
||||
std::ofstream f;
|
||||
f.open(path);
|
||||
f.close();
|
||||
std::filesystem::create_directories(directory);
|
||||
// open and close to make an existing empty file.
|
||||
// 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.
|
||||
f.open(path);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user