ReactOS 0.4.17-dev-940-g8bd6e85
CRecentFileEntry.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Management Console
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Recent file entry class
5 * COPYRIGHT: Copyright 2026 Eric Kohl (eric.kohl@reactos.org)
6 */
7
8#include "precomp.h"
9
10#define NDEBUG
11#include <debug.h>
12
14{
17}
18
20{
21 delete m_FileName;
22 delete m_DisplayName;
23}
24
25void
27{
28 WCHAR SystemDirectory[MAX_PATH];
30
31 Length = ::GetSystemDirectoryW(SystemDirectory, MAX_PATH);
32
33 if (_wcsnicmp(m_FileName.GetString(), SystemDirectory, Length) == 0)
34 {
36 }
37 else
38 {
39 PWSTR pBackslash1 = NULL, pBackslash2 = NULL, pBackslash3 = NULL;
40
41 pBackslash1 = wcschr(m_FileName.GetString(), L'\\');
42
43 if (pBackslash1)
44 pBackslash2 = wcschr(pBackslash1 + 1, L'\\');
45
46 if (pBackslash2)
47 pBackslash3 = wcsrchr(m_FileName.GetString(), L'\\');
48
49 if (pBackslash1 && pBackslash2 && pBackslash3 && (pBackslash2 != pBackslash3))
50 {
51 int prefixLength = pBackslash2 - m_FileName.GetString();
52 CAtlString str(m_FileName.Left(prefixLength + 1));
53 str.Append(L"...");
54 str.Append(pBackslash3);
56 }
57 else
58 {
60 }
61 }
62}
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
CStringT Left(int nCount) const
Definition: cstringt.h:776
CStringT Mid(int iFirst, int nCount) const
Definition: cstringt.h:748
CRecentFileEntry(const CAtlString &FileName)
CAtlString m_FileName
const CAtlString & FileName() const
CAtlString m_DisplayName
#define NULL
Definition: types.h:112
#define wcschr
Definition: compat.h:17
#define wcsrchr
Definition: compat.h:16
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2331
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
#define L(x)
Definition: resources.c:13
unsigned int UINT
Definition: sysinfo.c:13
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
short WCHAR
Definition: pedump.c:58
const WCHAR * str
uint16_t * PWSTR
Definition: typedefs.h:56