Skip to content

Commit

Permalink
chore: removes logic that detects the existence of INI files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bush2021 committed Sep 9, 2024
1 parent 404baaf commit f2eafb2
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@

const std::wstring kIniPath = GetAppDir() + L"\\chrome++.ini";

bool IsIniExist() {
if (PathFileExists(kIniPath.data())) {
return true;
}
return false;
}

std::wstring GetIniString(const std::wstring& section,
const std::wstring& key,
const std::wstring& default_value) {
Expand All @@ -30,7 +23,7 @@ std::wstring GetIniString(const std::wstring& section,
}

std::wstring GetCrCommandLine() {
return IsIniExist() ? GetIniString(L"General", L"CommandLine", L"") : L"";
return GetIniString(L"General", L"CommandLine", L"");
}

std::wstring CanonicalizePath(const std::wstring& path) {
Expand All @@ -42,10 +35,6 @@ std::wstring CanonicalizePath(const std::wstring& path) {
std::wstring GetDirPath(const std::wstring& dirType) {
std::wstring path = CanonicalizePath(GetAppDir() + L"\\..\\" + dirType);

if (!IsIniExist()) {
return path;
}

std::wstring DirBuffer(MAX_PATH, '\0');
::GetPrivateProfileStringW(L"General", (dirType + L"Dir").c_str(),
path.c_str(), &DirBuffer[0], MAX_PATH,
Expand All @@ -72,13 +61,11 @@ std::wstring GetDiskCacheDir() {
}

std::wstring GetBosskey() {
return IsIniExist() ? GetIniString(L"General", L"Bosskey", L"")
: std::wstring(L"");
return GetIniString(L"General", L"Bosskey", L"");
}

std::wstring GetTranslateKey() {
return IsIniExist() ? GetIniString(L"General", L"TranslateKey", L"")
: std::wstring(L"");
return GetIniString(L"General", L"TranslateKey", L"");
}

// View password without verification
Expand Down Expand Up @@ -151,8 +138,7 @@ bool IsNewTabDisable() {

// Customize disabled tab page name
std::wstring GetDisableTabName() {
return IsIniExist() ? GetIniString(L"Tabs", L"new_tab_disable_name", L"")
: L"";
return GetIniString(L"Tabs", L"new_tab_disable_name", L"");
}

#endif // CONFIG_H_
#endif // CONFIG_H_

0 comments on commit f2eafb2

Please sign in to comment.