https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fefc5f48238ba760576df…
commit fefc5f48238ba760576df0e5fe670045746486cf
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Dec 29 01:05:00 2021 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue May 16 12:37:49 2023 +0200
[RAPPS] Centralize RAPPS exposed names: registry & user local settings (#4214)
Centralize the names of the RAPPS' registry setting sub-key, and
user local settings & offline apps database sub-directories.
- Change the name of the application database sub-directory from
"rapps\rapps" to "RApps\appdb".
- Adjust the documentation to reflect this.
- Simplify CConfigParser constructor by removing GetINIFullPath().
---
base/applications/rapps/README.ENG | 10 ++++++----
base/applications/rapps/appdb.cpp | 8 ++++----
base/applications/rapps/configparser.cpp | 15 ++-------------
base/applications/rapps/include/configparser.h | 2 +-
base/applications/rapps/include/defines.h | 13 +++++++++++--
base/applications/rapps/misc.cpp | 2 +-
base/applications/rapps/settings.cpp | 7 +++----
base/applications/rapps/settingsdlg.cpp | 2 +-
base/applications/rapps/unattended.cpp | 4 ++--
9 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/base/applications/rapps/README.ENG b/base/applications/rapps/README.ENG
index 69d6cb1dd07..18abc406fb2 100644
--- a/base/applications/rapps/README.ENG
+++ b/base/applications/rapps/README.ENG
@@ -85,16 +85,18 @@ and synced every time RAPPS is launched for the first time.
NOTE: You can find the most current URL in rapps.h, defined as
APPLICATION_DATABASE_URL.
-To generate a RAPPS database (usually a rappmgr.cab archive), use the included scripts:
+To generate a RAPPS database (usually a rappmgr.cab/rappmgr2.cab archive), use
+the included scripts:
For Windows & other NT-derived: CreateCabFile.bat
For Linux & other UNIX flavors: CreateCabFile.sh
-Once the rappmgr.cab is downloaded to %appdata%\rapps, RAPPS extracts it using
cabinet.dll
-inside %appdata%\rapps\rapps, after that, it will parse all the *.txt files contained
therein.
+Once the rappmgr.cab is downloaded to the user's local %AppData%\RApps, RAPPS
extracts it
+using cabinet.dll inside %AppData%\RApps\appdb. After that, it will parse all the *.txt
+files contained therein.
-Every subsequent time the program tries to access the local .txt files
+Every subsequent time, the program tries to access the local .txt files
until a database update is manually triggered by the user.
If the rappmgr.cab file is moved or just missing, RAPPS will download it again.
diff --git a/base/applications/rapps/appdb.cpp b/base/applications/rapps/appdb.cpp
index b6fb33214ac..02a404f9f53 100644
--- a/base/applications/rapps/appdb.cpp
+++ b/base/applications/rapps/appdb.cpp
@@ -74,7 +74,7 @@ CAppDB::EnumerateFiles()
ClearList(m_Available);
CPathW AppsPath = m_BasePath;
- AppsPath += L"rapps";
+ AppsPath += RAPPS_DATABASE_SUBDIR;
CPathW WildcardPath = AppsPath;
WildcardPath += L"*.txt";
@@ -95,7 +95,7 @@ CAppDB::EnumerateFiles()
ATLASSERT(Info == NULL);
if (!Info)
{
- CConfigParser *Parser = new CConfigParser(FindFileData.cFileName);
+ CConfigParser *Parser = new CConfigParser(CPathW(AppsPath) +=
FindFileData.cFileName);
int Cat;
if (!Parser->GetInt(L"Category", Cat))
Cat = ENUM_INVALID;
@@ -130,7 +130,7 @@ CAppDB::UpdateAvailable()
SettingsInfo.bUseSource ? SettingsInfo.szSourceURL : APPLICATION_DATABASE_URL,
!SettingsInfo.bUseSource);
CPathW AppsPath = m_BasePath;
- AppsPath += L"rapps";
+ AppsPath += RAPPS_DATABASE_SUBDIR;
if (!ExtractFilesFromCab(APPLICATION_DATABASE_NAME, m_BasePath, AppsPath))
return;
@@ -243,7 +243,7 @@ CAppDB::RemoveCached()
{
// Delete icons
CPathW AppsPath = m_BasePath;
- AppsPath += L"rapps";
+ AppsPath += RAPPS_DATABASE_SUBDIR;
CPathW IconPath = AppsPath;
IconPath += L"icons";
DeleteWithWildcard(IconPath, L"*.ico");
diff --git a/base/applications/rapps/configparser.cpp
b/base/applications/rapps/configparser.cpp
index 11355b7beca..d550fbaedd4 100644
--- a/base/applications/rapps/configparser.cpp
+++ b/base/applications/rapps/configparser.cpp
@@ -7,6 +7,7 @@
* Copyright 2017 Alexander Shaposhnikov (sanchaez(a)reactos.org)
* Copyright 2021 Mark Jansen <mark.jansen(a)reactos.org>
*/
+
#include "rapps.h"
#include <debug.h>
@@ -24,19 +25,7 @@ struct CSectionNames
};
static CSectionNames g_Names;
-static CStringW
-GetINIFullPath(const CStringW &FileName)
-{
- CStringW szDir;
- CStringW szBuffer;
-
- GetStorageDirectory(szDir);
- szBuffer.Format(L"%ls\\rapps\\%ls", szDir.GetString(),
FileName.GetString());
-
- return szBuffer;
-}
-
-CConfigParser::CConfigParser(const CStringW &FileName) :
szConfigPath(GetINIFullPath(FileName))
+CConfigParser::CConfigParser(const CStringW &FilePath) : szConfigPath(FilePath)
{
CacheINI();
}
diff --git a/base/applications/rapps/include/configparser.h
b/base/applications/rapps/include/configparser.h
index 364d073383c..4573e90f195 100644
--- a/base/applications/rapps/include/configparser.h
+++ b/base/applications/rapps/include/configparser.h
@@ -13,7 +13,7 @@ class CConfigParser
ReadSection(CStringW &Buffer, const CStringW &Section, BOOL isArch);
public:
- CConfigParser(const CStringW &FileName);
+ CConfigParser(const CStringW &FilePath);
BOOL
GetString(const CStringW &KeyName, CStringW &ResultString);
diff --git a/base/applications/rapps/include/defines.h
b/base/applications/rapps/include/defines.h
index f9d1d6d65ce..855927cb4a1 100644
--- a/base/applications/rapps/include/defines.h
+++ b/base/applications/rapps/include/defines.h
@@ -29,6 +29,15 @@
#include "resource.h"
#include "winmain.h"
-#define APPLICATION_DATABASE_URL
L"https://rapps.reactos.org/rappmgr2.cab"
-#define APPLICATION_DATABASE_NAME L"rappmgr2.cab"
+/* Name of the registry sub-key where RAPPS settings are stored, and
+ * of the local AppData sub-directory where the RAPPS files are stored. */
+#define RAPPS_NAME L"RApps"
+
+/* Name of the RAPPS sub-directory where the offline RAPPS database is stored */
+#define RAPPS_DATABASE_SUBDIR L"appdb"
+
+/* URL and filename of the online RAPPS database */
+#define APPLICATION_DATABASE_URL
L"https://rapps.reactos.org/rappmgr2.cab"
+#define APPLICATION_DATABASE_NAME L"rappmgr2.cab"
+
#define MAX_STR_LEN 256
diff --git a/base/applications/rapps/misc.cpp b/base/applications/rapps/misc.cpp
index a5da21d45ce..bf3b1ddc6b5 100644
--- a/base/applications/rapps/misc.cpp
+++ b/base/applications/rapps/misc.cpp
@@ -153,7 +153,7 @@ GetStorageDirectory(CStringW &Directory)
BOOL bHasPath = SHGetSpecialFolderPathW(NULL, DirectoryStr, CSIDL_LOCAL_APPDATA,
TRUE);
if (bHasPath)
{
- PathAppendW(DirectoryStr, L"rapps");
+ PathAppendW(DirectoryStr, RAPPS_NAME);
}
CachedDirectory.ReleaseBuffer();
diff --git a/base/applications/rapps/settings.cpp b/base/applications/rapps/settings.cpp
index 4a00186f2ec..b0a0c191ebd 100644
--- a/base/applications/rapps/settings.cpp
+++ b/base/applications/rapps/settings.cpp
@@ -218,7 +218,7 @@ BOOL
LoadSettings(PSETTINGS_INFO pSettingsInfo)
{
ATL::CRegKey RegKey;
- if (RegKey.Open(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", KEY_READ)
!= ERROR_SUCCESS)
+ if (RegKey.Open(HKEY_CURRENT_USER, L"Software\\ReactOS\\" RAPPS_NAME,
KEY_READ) != ERROR_SUCCESS)
{
return FALSE;
}
@@ -245,9 +245,8 @@ SaveSettings(HWND hwnd, PSETTINGS_INFO pSettingsInfo)
(wp.showCmd == SW_MAXIMIZE || (wp.showCmd == SW_SHOWMINIMIZED &&
(wp.flags & WPF_RESTORETOMAXIMIZED)));
}
- if (RegKey.Create(
- HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, NULL) !=
- ERROR_SUCCESS)
+ if (RegKey.Create(HKEY_CURRENT_USER, L"Software\\ReactOS\\" RAPPS_NAME,
NULL,
+ REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, NULL) != ERROR_SUCCESS)
{
return FALSE;
}
diff --git a/base/applications/rapps/settingsdlg.cpp
b/base/applications/rapps/settingsdlg.cpp
index b75a136c0ff..fdf99d99fb7 100644
--- a/base/applications/rapps/settingsdlg.cpp
+++ b/base/applications/rapps/settingsdlg.cpp
@@ -246,7 +246,7 @@ SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
CStringW szMsgText;
szMsgText.LoadStringW(IDS_URL_INVALID);
- MessageBoxW(hDlg, szMsgText, NULL, 0);
+ MessageBoxW(hDlg, szMsgText, NULL, MB_OK);
SetFocus(GetDlgItem(hDlg, IDC_SOURCE_URL));
break;
}
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 8311e47a976..94fecfbeea7 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -241,13 +241,13 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
if (argc == 1) // RAPPS is launched without options
{
- // Check for if rapps MainWindow is already launched in another process
+ // Check whether the RAPPS MainWindow is already launched in another process
HANDLE hMutex;
hMutex = CreateMutexW(NULL, FALSE, szWindowClass);
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
{
- /* If already started, it is found its window */
+ /* If already started, find its window */
HWND hWindow = FindWindowW(szWindowClass, NULL);
/* Activate window */