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