2024-03-20 07:46:28 +01:00
|
|
|
|
/*
|
|
|
|
|
* mru.c
|
|
|
|
|
*
|
|
|
|
|
* This file is part of Emu48
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2007 Christoph Gie<EFBFBD>elink
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
#include "resource.h"
|
|
|
|
|
#include "Emu48.h"
|
|
|
|
|
|
|
|
|
|
static TCHAR szOriginal[MAX_PATH] = _T("");
|
|
|
|
|
|
|
|
|
|
static LPTSTR *ppszFiles = NULL; // pointer to MRU table
|
2024-03-20 07:46:28 +01:00
|
|
|
|
static UINT nEntry = 0; // no. of MRU entries
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
static BOOL GetMenuPosForId(HMENU hMenu, UINT nItem, HMENU *phMruMenu, UINT *pnMruPos)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
|
|
|
|
HMENU hSubMenu;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
UINT i,nID,nMaxID;
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
nMaxID = GetMenuItemCount(hMenu);
|
|
|
|
|
for (i = 0; i < nMaxID; ++i)
|
|
|
|
|
{
|
|
|
|
|
nID = GetMenuItemID(hMenu,i); // get ID
|
|
|
|
|
|
|
|
|
|
if (nID == 0) continue; // separator or invalid command
|
|
|
|
|
|
|
|
|
|
if (nID == (UINT)-1) // possibly a popup menu
|
|
|
|
|
{
|
|
|
|
|
hSubMenu = GetSubMenu(hMenu,i); // try to get handle to popup menu
|
|
|
|
|
if (hSubMenu != NULL) // it's a popup menu
|
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// recursive search
|
|
|
|
|
if (GetMenuPosForId(hSubMenu,nItem,phMruMenu,pnMruPos))
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nID == nItem) // found ID
|
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
*phMruMenu = hMenu; // remember menu and position
|
|
|
|
|
*pnMruPos = i;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
BOOL MruInit(UINT nNum)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
|
|
|
|
HMENU hMenu = GetMenu(hWnd); // main menu
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (hMenu == NULL) return FALSE; // failed, no menu bar
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
|
|
|
|
_ASSERT(ppszFiles == NULL); // MRU already initialized
|
|
|
|
|
|
|
|
|
|
// no. of files in MRU list
|
|
|
|
|
nEntry = ReadSettingsInt(_T("MRU"),_T("FileCount"),nNum);
|
|
|
|
|
|
|
|
|
|
if (nEntry > 0) // allocate MRU table
|
|
|
|
|
{
|
|
|
|
|
// create MRU table
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if ((ppszFiles = (LPTSTR *) malloc(nEntry * sizeof(*ppszFiles))) == NULL)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
// fill each entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
for (nNum = 0; nNum < nEntry; ++nNum)
|
|
|
|
|
ppszFiles[nNum] = NULL;
|
|
|
|
|
|
|
|
|
|
MruReadList(); // read actual MRU list
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return TRUE;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID MruCleanup(VOID)
|
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
UINT i;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
|
|
|
|
MruWriteList(); // write actual MRU list
|
|
|
|
|
|
|
|
|
|
if (ppszFiles != NULL) // table defined
|
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
for (i = 0; i < nEntry; ++i) // cleanup each entry
|
|
|
|
|
{
|
2024-03-20 07:46:29 +01:00
|
|
|
|
if (ppszFiles[i] != NULL) // valid entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
free(ppszFiles[i]); // cleanup entry
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
free(ppszFiles); // free table
|
2024-03-20 07:46:28 +01:00
|
|
|
|
ppszFiles = NULL;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID MruAdd(LPCTSTR lpszEntry)
|
|
|
|
|
{
|
|
|
|
|
TCHAR szFilename[MAX_PATH];
|
|
|
|
|
LPTSTR lpFilePart;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
UINT i;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (ppszFiles != NULL) // MRU initialized
|
|
|
|
|
{
|
|
|
|
|
_ASSERT(nEntry > 0); // must have entries
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// get full path name
|
|
|
|
|
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// look if entry is already in table
|
|
|
|
|
for (i = 0; i < nEntry; ++i)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// already in table -> quit
|
2024-03-20 07:46:29 +01:00
|
|
|
|
if ( ppszFiles[i] != NULL // valid entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
|
|
|
|
|
{
|
|
|
|
|
MruMoveTop(i); // move to top and update menu
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
i = nEntry - 1; // last index
|
2024-03-20 07:46:29 +01:00
|
|
|
|
if (ppszFiles[i] != NULL) // valid entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
free(ppszFiles[i]); // free oldest entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
for (; i > 0; --i) // move old entries 1 line down
|
|
|
|
|
{
|
|
|
|
|
ppszFiles[i] = ppszFiles[i-1];
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// add new entry to top
|
|
|
|
|
ppszFiles[0] = DuplicateString(szFilename);
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
VOID MruRemove(UINT nIndex)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// MRU initialized and index inside valid range
|
|
|
|
|
if (ppszFiles != NULL && nIndex < nEntry)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
free(ppszFiles[nIndex]); // free entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
for (; nIndex < nEntry - 1; ++nIndex) // move below entries 1 line up
|
|
|
|
|
{
|
|
|
|
|
ppszFiles[nIndex] = ppszFiles[nIndex+1];
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
ppszFiles[nIndex] = NULL; // clear last line
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
VOID MruMoveTop(UINT nIndex)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// MRU initialized and index inside valid range
|
|
|
|
|
if (ppszFiles != NULL && nIndex < nEntry)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
LPTSTR lpszEntry = ppszFiles[nIndex];// remember selected entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
for (; nIndex > 0; --nIndex) // move above entries 1 line down
|
|
|
|
|
{
|
|
|
|
|
ppszFiles[nIndex] = ppszFiles[nIndex-1];
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
ppszFiles[0] = lpszEntry; // insert entry on top
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
UINT MruEntries(VOID)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
|
|
|
|
return nEntry;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:29 +01:00
|
|
|
|
UINT MruID(LPCTSTR lpszEntry)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:29 +01:00
|
|
|
|
TCHAR szFilename[MAX_PATH];
|
|
|
|
|
LPTSTR lpFilePart;
|
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
|
|
if (ppszFiles != NULL) // MRU initialized
|
|
|
|
|
{
|
|
|
|
|
_ASSERT(nEntry > 0); // must have entries
|
|
|
|
|
|
|
|
|
|
// get full path name
|
|
|
|
|
GetFullPathName(lpszEntry,ARRAYSIZEOF(szFilename),szFilename,&lpFilePart);
|
|
|
|
|
|
|
|
|
|
// look if entry is already in table
|
|
|
|
|
for (i = 0; i < nEntry; ++i)
|
|
|
|
|
{
|
|
|
|
|
if ( ppszFiles[i] != NULL // valid entry
|
|
|
|
|
&& lstrcmpi(ppszFiles[i],szFilename) == 0)
|
|
|
|
|
{
|
|
|
|
|
return i; // return ID
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (UINT) -1; // not found
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID MruFilename(UINT nIndex, LPTSTR szFilename, UINT nBuffersize)
|
|
|
|
|
{
|
|
|
|
|
*szFilename = 0; // not found
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
|
|
|
|
// MRU initialized and index inside valid range
|
|
|
|
|
if (ppszFiles != NULL && nIndex < nEntry)
|
|
|
|
|
{
|
2024-03-20 07:46:29 +01:00
|
|
|
|
_ASSERT(ppszFiles[nIndex] != NULL); // valid entry
|
|
|
|
|
lstrcpyn(szFilename,ppszFiles[nIndex],nBuffersize);
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
2024-03-20 07:46:29 +01:00
|
|
|
|
return;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
VOID MruUpdateMenu(HMENU hMenu)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
TCHAR szCurPath[MAX_PATH];
|
|
|
|
|
BOOL bEmpty;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
UINT i;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (hMenu != NULL) // have menu
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
HMENU hMruMenu; // menu handle for MRU list
|
|
|
|
|
UINT nMruPos; // insert position for MRU list
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
_ASSERT(IsMenu(hMenu)); // validate menu handle
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// search for menu position of ID_FILE_MRU_FILE1
|
|
|
|
|
if (GetMenuPosForId(hMenu,ID_FILE_MRU_FILE1,&hMruMenu,&nMruPos))
|
|
|
|
|
{
|
|
|
|
|
if (*szOriginal == 0) // get orginal value of first MRU entry
|
|
|
|
|
{
|
|
|
|
|
VERIFY(GetMenuString(hMruMenu,nMruPos,szOriginal,ARRAYSIZEOF(szOriginal),MF_BYPOSITION));
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (nEntry == 0) // kill MRU menu entry
|
|
|
|
|
{
|
|
|
|
|
// delete MRU menu
|
|
|
|
|
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// delete the following separator
|
|
|
|
|
_ASSERT((GetMenuState(hMruMenu,nMruPos,MF_BYPOSITION) & MF_SEPARATOR) != 0);
|
|
|
|
|
DeleteMenu(hMruMenu,nMruPos,MF_BYPOSITION);
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (ppszFiles != NULL) // MRU initialized
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
_ASSERT(nEntry > 0); // must have entries
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// delete all menu entries
|
|
|
|
|
for (i = 0; DeleteMenu(hMenu,ID_FILE_MRU_FILE1+i,MF_BYCOMMAND) != FALSE; ++i) { }
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// check if MRU list is empty
|
|
|
|
|
for (bEmpty = TRUE, i = 0; bEmpty && i < nEntry; ++i)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
bEmpty = (ppszFiles[i] == NULL);
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
|
|
|
|
if (bEmpty) // MRU list is empty
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// fill with orginal string
|
|
|
|
|
VERIFY(InsertMenu(hMruMenu,nMruPos,MF_STRING|MF_BYPOSITION|MF_GRAYED,ID_FILE_MRU_FILE1,szOriginal));
|
|
|
|
|
return;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// current directory
|
|
|
|
|
GetCurrentDirectory(ARRAYSIZEOF(szCurPath),szCurPath);
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
for (i = 0; i < nEntry; ++i) // add menu entries
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (ppszFiles[i] != NULL) // valid entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
TCHAR szMenuname[2*MAX_PATH+3];
|
|
|
|
|
TCHAR szFilename[MAX_PATH];
|
|
|
|
|
LPTSTR lpFilePart,lpszPtr;
|
|
|
|
|
|
|
|
|
|
// check if file path and current path is identical
|
|
|
|
|
if (GetFullPathName(ppszFiles[i],ARRAYSIZEOF(szFilename),szFilename,&lpFilePart))
|
|
|
|
|
{
|
|
|
|
|
TCHAR szCutname[MAX_PATH];
|
|
|
|
|
|
|
|
|
|
*(lpFilePart-1) = 0; // devide path and name
|
|
|
|
|
|
|
|
|
|
// name is current directory -> use only name
|
|
|
|
|
if (lstrcmpi(szCurPath,szFilename) == 0)
|
|
|
|
|
{
|
|
|
|
|
// short name view
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// full name view
|
|
|
|
|
lpFilePart = ppszFiles[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// cut filename to fit into menu
|
|
|
|
|
GetCutPathName(lpFilePart,szCutname,ARRAYSIZEOF(szCutname),36);
|
|
|
|
|
lpFilePart = szCutname;
|
|
|
|
|
|
|
|
|
|
// adding accelerator key
|
|
|
|
|
lpszPtr = szMenuname;
|
|
|
|
|
*lpszPtr++ = _T('&');
|
|
|
|
|
*lpszPtr++ = _T('0') + ((i + 1) % 10);
|
|
|
|
|
*lpszPtr++ = _T(' ');
|
|
|
|
|
|
|
|
|
|
// copy file to view buffer and expand & to &&
|
|
|
|
|
while (*lpFilePart != 0)
|
|
|
|
|
{
|
|
|
|
|
if (*lpFilePart == _T('&'))
|
|
|
|
|
{
|
|
|
|
|
*lpszPtr++ = *lpFilePart;
|
|
|
|
|
}
|
|
|
|
|
*lpszPtr++ = *lpFilePart++;
|
|
|
|
|
}
|
|
|
|
|
*lpszPtr = 0;
|
|
|
|
|
|
|
|
|
|
VERIFY(InsertMenu(hMruMenu,nMruPos+i,
|
|
|
|
|
MF_STRING|MF_BYPOSITION,ID_FILE_MRU_FILE1+i,
|
|
|
|
|
szMenuname));
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID MruWriteList(VOID)
|
|
|
|
|
{
|
|
|
|
|
TCHAR szItemname[32];
|
2024-03-20 07:46:28 +01:00
|
|
|
|
UINT i;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (nEntry > 0)
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
// no. of files in MRU list
|
|
|
|
|
WriteSettingsInt(_T("MRU"),_T("FileCount"),nEntry);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nEntry; ++i) // add menu entries
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
_ASSERT(ppszFiles != NULL); // MRU not initialized
|
|
|
|
|
wsprintf(szItemname,_T("File%d"),i+1);
|
2024-03-20 07:46:29 +01:00
|
|
|
|
if (ppszFiles[i] != NULL) // valid entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
|
|
|
|
WriteSettingsString(_T("MRU"),szItemname,ppszFiles[i]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DelSettingsKey(_T("MRU"),szItemname);
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VOID MruReadList(VOID)
|
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
TCHAR szFilename[MAX_PATH];
|
|
|
|
|
TCHAR szItemname[32];
|
|
|
|
|
UINT i;
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < nEntry; ++i) // add menu entries
|
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
_ASSERT(ppszFiles != NULL); // MRU not initialized
|
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
wsprintf(szItemname,_T("File%d"),i+1);
|
|
|
|
|
ReadSettingsString(_T("MRU"),szItemname,_T(""),szFilename,ARRAYSIZEOF(szFilename));
|
|
|
|
|
|
2024-03-20 07:46:29 +01:00
|
|
|
|
if (ppszFiles[i] != NULL) // valid entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
{
|
2024-03-20 07:46:28 +01:00
|
|
|
|
free(ppszFiles[i]); // free entry
|
2024-03-20 07:46:28 +01:00
|
|
|
|
ppszFiles[i] = NULL; // clear last line
|
|
|
|
|
}
|
2024-03-20 07:46:28 +01:00
|
|
|
|
|
2024-03-20 07:46:28 +01:00
|
|
|
|
if (*szFilename) // read a valid entry
|
|
|
|
|
{
|
|
|
|
|
ppszFiles[i] = DuplicateString(szFilename);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|