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)
|
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);
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user