From 0c182785e23b5e266338756cb8ba6efe193eefbf Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Wed, 22 Feb 2017 06:21:21 +0100 Subject: [PATCH] src/system/helpers.cpp: Add function readLink() --- src/system/helpers.cpp | 10 ++++++++++ src/system/helpers.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index e6e4a1e2e..59d64524a 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1272,3 +1272,13 @@ std::string Lang2ISO639_1(std::string& lang) return ret; } + +string readLink(string lnk) +{ + char buf[PATH_MAX]; + memset(buf, 0, sizeof(buf)-1); + if (readlink(lnk.c_str(), buf, sizeof(buf)-1) != -1) + return (string)buf; + + return ""; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index e117e011e..c7f3ae06a 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -148,5 +148,6 @@ bool split_config_string(const std::string &str, std::map