From f3917256af4a7535202a73a0649264c6ac254392 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 11 Aug 2016 14:14:12 +0200 Subject: [PATCH] helpers: rename get_path() to proper check_var() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/48a7068c93f3fc91bd199b4655d30ccb631fc44f Author: vanhofen Date: 2016-08-11 (Thu, 11 Aug 2016) Origin message was: ------------------ - helpers: rename get_path() to proper check_var() ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 16 ++++++++-------- src/system/helpers.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 66edc4c2f..25139f927 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -97,7 +97,7 @@ void wakeup_hdd(const char *hdd_dir, bool msg) msg = false; if(msg) loadBox.paint(); - std::string s = get_path("/bin/wakeup.sh"); + std::string s = check_var("/bin/wakeup.sh"); my_system(2,s.c_str(),hdd_dir); if (!g_settings.hdd_wakeup) { @@ -1202,16 +1202,16 @@ std::string filehash(const char *file) return os.str(); } -std::string get_path(const char *path) +std::string check_var(const char *file) { - if(path[0] == '/' && strstr(path,"/var") == 0) + std::string var = "/var"; + if(file[0] == '/' && strstr(file, var.c_str()) == 0) { - std::string varc = "/var"; - varc += path; + std::string varfile = var + file; - if(file_exists(varc.c_str())) - return varc; + if (file_exists(varfile)) + return varfile; } - return path; + return file; } diff --git a/src/system/helpers.h b/src/system/helpers.h index e90a2e82a..d952c5ed8 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -124,7 +124,7 @@ std::string Lang2ISO639_1(std::string& lang); //NI int getpidof(const char *process); std::string filehash(const char * file); -std::string get_path(const char * path); +std::string check_var(const char * file); inline bool file_exists(const std::string file) { return file_exists(file.c_str()); } #endif