1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

use filename()

Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
This commit is contained in:
Pascal Bauer 2024-08-30 15:59:11 +02:00 committed by Niklas Eiling
parent a9de4d8555
commit 2ffb635a4a
2 changed files with 2 additions and 7 deletions

View file

@ -41,9 +41,7 @@ size_t IpDevice::addr() const {
}
bool IpDevice::is_path_valid(const std::filesystem::path unsafe_path) {
// Split the string at last slash
int pos = unsafe_path.u8string().rfind('/');
std::string assumed_device_name = unsafe_path.u8string().substr(pos + 1);
std::string assumed_device_name = unsafe_path.filename();
// Match format of hexaddr.devicename
if (!std::regex_match(assumed_device_name,

View file

@ -46,7 +46,4 @@ std::filesystem::path PlatformDevice::override_path() const {
return this->m_override_path;
}
std::string PlatformDevice::name() const {
size_t pos = this->m_path.u8string().rfind('/');
return this->m_path.u8string().substr(pos + 1);
}
std::string PlatformDevice::name() const { return this->m_path.filename(); }