4.30 beta

This commit is contained in:
Igor Pavlov
2005-11-18 00:00:00 +00:00
committed by Kornel Lesiński
parent bcd1db2f5a
commit e18587ba51
214 changed files with 5385 additions and 2712 deletions

View File

@@ -63,7 +63,21 @@ static UString GetModuleFolderPrefix()
static wchar_t *kFormatFolderName = L"Formats";
static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
static LPCTSTR kProgramPathValue = TEXT("Path");
static LPCWSTR kProgramPathValue = L"Path";
#ifdef _WIN32
static bool ReadPathFromRegistry(HKEY baseKey, UString &path)
{
NRegistry::CKey key;
if(key.Open(baseKey, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
if (key.QueryValue(kProgramPathValue, path) == ERROR_SUCCESS)
{
NName::NormalizeDirPathPrefix(path);
return true;
}
return false;
}
#endif
static UString GetBaseFolderPrefixFromRegistry()
{
@@ -72,28 +86,12 @@ static UString GetBaseFolderPrefixFromRegistry()
if (NFind::FindFile(moduleFolderPrefix + kFormatFolderName, fileInfo))
if (fileInfo.IsDirectory())
return moduleFolderPrefix;
CSysString pathSys;
UString path;
#ifdef _WIN32
{
NRegistry::CKey key;
if(key.Open(HKEY_CURRENT_USER, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
if (key.QueryValue(kProgramPathValue, pathSys) == ERROR_SUCCESS)
{
UString path = GetUnicodeString(pathSys);
NName::NormalizeDirPathPrefix(path);
return path;
}
}
{
NRegistry::CKey key;
if(key.Open(HKEY_LOCAL_MACHINE, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
if (key.QueryValue(kProgramPathValue, pathSys) == ERROR_SUCCESS)
{
UString path = GetUnicodeString(pathSys);
NName::NormalizeDirPathPrefix(path);
return path;
}
}
if(ReadPathFromRegistry(HKEY_CURRENT_USER, path))
return path;
if(ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
return path;
#endif
return moduleFolderPrefix;
}