mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 07:15:40 +00:00
[RAPPS] move icon to a field in .txt file (#2941)
* [RAPPS] move icon to a field in .txt file * [RAPPS] add function PathAppendNoDirEscapeW, apply it.
This commit is contained in:
parent
e636373016
commit
4482d0f455
5 changed files with 93 additions and 16 deletions
|
@ -407,3 +407,49 @@ BOOL CConfigParser::GetInt(const ATL::CStringW& KeyName, INT& iResult)
|
|||
return (iResult > 0);
|
||||
}
|
||||
// CConfigParser
|
||||
|
||||
|
||||
BOOL PathAppendNoDirEscapeW(LPWSTR pszPath, LPCWSTR pszMore)
|
||||
{
|
||||
WCHAR pszPathBuffer[MAX_PATH]; // buffer to store result
|
||||
WCHAR pszPathCopy[MAX_PATH];
|
||||
|
||||
if (!PathCanonicalizeW(pszPathCopy, pszPath))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PathRemoveBackslashW(pszPathCopy);
|
||||
|
||||
if (StringCchCopyW(pszPathBuffer, _countof(pszPathBuffer), pszPathCopy) != S_OK)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!PathAppendW(pszPathBuffer, pszMore))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size_t PathLen;
|
||||
if (StringCchLengthW(pszPathCopy, _countof(pszPathCopy), &PathLen) != S_OK)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
int CommonPrefixLen = PathCommonPrefixW(pszPathCopy, pszPathBuffer, NULL);
|
||||
|
||||
if ((unsigned int)CommonPrefixLen != PathLen)
|
||||
{
|
||||
// pszPathBuffer should be a file/folder under pszPath.
|
||||
// but now common prefix len is smaller than length of pszPathCopy
|
||||
// hacking use ".." ?
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (StringCchCopyW(pszPath, MAX_PATH, pszPathBuffer) != S_OK)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue