From 8fcd9880a5e30ac1871046ba5f108e9b1ee7abb0 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 24 Apr 2023 17:52:50 +0600 Subject: [PATCH] fix --- source/my_cmd_and_path.h | 2 ++ source/ublexec.cc | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/my_cmd_and_path.h b/source/my_cmd_and_path.h index dfdb4b7..b700dc5 100644 --- a/source/my_cmd_and_path.h +++ b/source/my_cmd_and_path.h @@ -9,5 +9,7 @@ #define path_css "/usr/share/ublexec/css/ublexec.css" #define app_name "ublexec" #define path_img_head_background "/usr/share/ublexec/images/logo-background.png" +#define path_all_applications "/usr/share/applications/" +#define file_source_login_min_max "/etc/login.defs" #endif diff --git a/source/ublexec.cc b/source/ublexec.cc index f51c584..58d4c44 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -954,8 +954,8 @@ unsigned short MainWindow::read_uid_min_max(string filename, string search){ } void MainWindow::pars_users() { - unsigned short uid_min = this->read_uid_min_max("/etc/login.defs", "UID_MIN"); - unsigned short uid_max = this->read_uid_min_max("/etc/login.defs", "UID_MAX"); + unsigned short uid_min = this->read_uid_min_max(file_source_login_min_max, "UID_MIN"); + unsigned short uid_max = this->read_uid_min_max(file_source_login_min_max, "UID_MAX"); while (true) { errno = 0; passwd* entry = getpwent(); @@ -996,10 +996,10 @@ void MainWindow::pars_apps() { struct struct_App App; string file_name = ""; string str_Categories; - string path = "/usr/share/applications/"; + string path = path_all_applications; for (const auto & entry : fs::directory_iterator(path)) { file_name = entry.path().filename().string(); - path = "/usr/share/applications/"+file_name; + path = string(path_all_applications) +file_name; if (file_name.find(".desktop") != std::string::npos) { GKeyFile *gfile=g_key_file_new(); g_key_file_load_from_file(gfile, path.c_str(), G_KEY_FILE_KEEP_TRANSLATIONS, NULL);