Code improvements
This commit is contained in:
parent
61bee62c5b
commit
768e95c45f
|
@ -261,28 +261,28 @@ void MainWindow::closeEvent (QCloseEvent *event)
|
||||||
// os definition
|
// os definition
|
||||||
void MainWindow::defineOSspec()
|
void MainWindow::defineOSspec()
|
||||||
{
|
{
|
||||||
const std::string home_path = StringOps::rstrip( QStandardPaths::locate( QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory ).toStdString(), "/" );
|
/*const std::string home_path = StringOps::rstrip( QStandardPaths::locate( QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory ).toStdString(), "/" );*/
|
||||||
switch ( this->OS ) {
|
switch ( this->OS ) {
|
||||||
case 1:
|
case 1:
|
||||||
// unix-like
|
// unix-like
|
||||||
this->configs_path = home_path + "/.config/LogDoctor/logdoctor.conf";
|
/*this->configs_path = home_path + "/.config/LogDoctor/logdoctor.conf";
|
||||||
this->logdoc_path = home_path + "/.local/share/LogDoctor";
|
this->logdoc_path = home_path + "/.local/share/LogDoctor";*/
|
||||||
this->db_data_path = logdoc_path;
|
this->db_data_path = logdoc_path;
|
||||||
this->db_hashes_path = logdoc_path;
|
this->db_hashes_path = logdoc_path;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
// windows
|
// windows
|
||||||
this->configs_path = home_path + "/AppData/Local/LogDoctor/logdoctor.conf";
|
/*this->configs_path = home_path + "/AppData/Local/LogDoctor/logdoctor.conf";
|
||||||
this->logdoc_path = home_path + "/AppData/Local/LogDoctor";
|
this->logdoc_path = home_path + "/AppData/Local/LogDoctor";*/
|
||||||
this->db_data_path = logdoc_path;
|
this->db_data_path = logdoc_path;
|
||||||
this->db_hashes_path = logdoc_path;
|
this->db_hashes_path = logdoc_path;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// darwin-based
|
// darwin-based
|
||||||
this->configs_path = home_path + "/Lybrary/Preferences/LogDoctor/logdoctor.conf";
|
/*this->configs_path = home_path + "/Lybrary/Preferences/LogDoctor/logdoctor.conf";
|
||||||
this->logdoc_path = home_path + "/Lybrary/Application Support/LogDoctor";
|
this->logdoc_path = home_path + "/Lybrary/Application Support/LogDoctor";*/
|
||||||
this->db_data_path = logdoc_path;
|
this->db_data_path = logdoc_path;
|
||||||
this->db_hashes_path = logdoc_path;
|
this->db_hashes_path = logdoc_path;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -464,28 +464,35 @@ private:
|
||||||
const unsigned int APACHE_ID=11, NGINX_ID=12, IIS_ID=13;
|
const unsigned int APACHE_ID=11, NGINX_ID=12, IIS_ID=13;
|
||||||
|
|
||||||
// operating system
|
// operating system
|
||||||
|
const std::string home_path = StringOps::rstrip( QStandardPaths::locate( QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory ).toStdString(), "/" );
|
||||||
// 1: linux, 2:windows, 3:mac
|
// 1: linux, 2:windows, 3:mac
|
||||||
#if defined( Q_OS_UNIX )
|
#if defined( Q_OS_UNIX )
|
||||||
// Unix-like systems: Linux, BSD and SysV
|
// Unix-like systems: Linux, BSD and SysV
|
||||||
const unsigned int OS = 1;
|
const unsigned int OS = 1;
|
||||||
|
const std::string configs_path = this->home_path + "/.config/LogDoctor/logdoctor.conf";
|
||||||
|
const std::string logdoc_path = this->home_path + "/.local/share/LogDoctor";
|
||||||
#elif defined( Q_OS_WIN )
|
#elif defined( Q_OS_WIN )
|
||||||
// Microsoft Windows systems
|
// Microsoft Windows systems
|
||||||
const unsigned int this->OS = 2;
|
const unsigned int OS = 2;
|
||||||
|
const std::string configs_path = this->home_path + "/AppData/Local/LogDoctor/logdoctor.conf";
|
||||||
|
const std::string logdoc_path = this->home_path + "/AppData/Local/LogDoctor";
|
||||||
#elif defined( Q_OS_DARWIN )
|
#elif defined( Q_OS_DARWIN )
|
||||||
// Darwin-based systems: macOS, macOS, iOS, watchOS and tvOS.
|
// Darwin-based systems: macOS, iOS, watchOS and tvOS.
|
||||||
const unsigned int this->OS = 3;
|
const unsigned int OS = 3;
|
||||||
|
const std::string configs_path = this->home_path + "/Lybrary/Preferences/LogDoctor/logdoctor.conf";
|
||||||
|
const std::string logdoc_path = this->home_path + "/Lybrary/Application Support/LogDoctor";
|
||||||
#else
|
#else
|
||||||
#error "System not supported"
|
#error "System not supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void defineOSspec();
|
void defineOSspec();
|
||||||
std::string logdoc_path;
|
/*std::string logdoc_path;
|
||||||
|
std::string configs_path;*/
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
//// CONFIGURATIONS ////
|
//// CONFIGURATIONS ////
|
||||||
////////////////////////
|
////////////////////////
|
||||||
std::string configs_path;
|
|
||||||
void readConfigs();
|
void readConfigs();
|
||||||
void writeConfigs();
|
void writeConfigs();
|
||||||
// string to bool and vice versa
|
// string to bool and vice versa
|
||||||
|
|
Loading…
Reference in a new issue