1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 11:19:10 +00:00

Merge pull request #275 from zrax/file-utils

Unify filesystem utilities
This commit is contained in:
2013-01-22 16:27:26 -08:00
148 changed files with 1545 additions and 4225 deletions

View File

@ -60,8 +60,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAudible.h"
#include "plCreatableIndex.h"
#include "plgDispatch.h"
#include "plFile/plFileUtils.h"
#include "plFile/hsFiles.h"
#include "hsGeometry3.h"
#include "plLoadMask.h"
#include "hsMatrix44.h"

View File

@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "plgDispatch.h"
#include "plFile/plFileUtils.h"
#include "plAnimComponent.h"
#include "plAudioComponents.h"
@ -588,21 +587,20 @@ uint32_t plBaseSoundEmitterComponent::ICalcSourceBufferFlags( void ) const
return bufferFlags;
}
plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags )
plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const plFileName &fileName, plMaxNode *srcNode, uint32_t srcBufferFlags )
{
plSoundBuffer* sb = IGetSourceBuffer(fileName, srcNode, srcBufferFlags);
const char* plasmaDir = plMaxConfig::GetClientPath();
if (plasmaDir)
plFileName plasmaDir = plMaxConfig::GetClientPath();
if (plasmaDir.IsValid())
{
char sfxPath[MAX_PATH];
sprintf(sfxPath, "%ssfx\\%s", plasmaDir, plFileUtils::GetFileName(fileName));
plFileName sfxPath = plFileName::Join(plasmaDir, "sfx", fileName.GetFileName());
// Export any localized versions as well
for (int i = 0; i < plLocalization::GetNumLocales(); i++)
{
char localName[MAX_PATH];
if (plLocalization::ExportGetLocalized(sfxPath, i, localName))
plFileName localName = plLocalization::ExportGetLocalized(sfxPath, i);
if (localName.IsValid())
{
IGetSourceBuffer(localName, srcNode, srcBufferFlags);
}
@ -612,58 +610,45 @@ plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const char *fileN
return sb;
}
plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags )
plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer(const plFileName &fileName, plMaxNode *srcNode, uint32_t srcBufferFlags)
{
plKey key;
plString keyName;
char fullPath[ MAX_PATH ];
// ***TEMP plString REVISIT***
char tempPath[ MAX_PATH ];
strncpy(tempPath, fileName, MAX_PATH);
::PathStripPath( tempPath );
keyName = tempPath;
plString keyName = fileName.GetFileName();
// TEMP HACK until we get packed sounds:
// Given the source filename, we check to see if it's in our plasma game directory. If not, or if
// it's out of date, we copy it over. We'll truncate the filename inside plSoundBuffer when we're ready.
const char *plasmaDir = plMaxConfig::GetClientPath();
if( plasmaDir != nil )
plFileName plasmaDir = plMaxConfig::GetClientPath();
plFileName rfilename = fileName;
if (plasmaDir.IsValid())
{
strcpy( fullPath, plasmaDir );
strcat( fullPath, "sfx\\" );
plFileName fullPath = plFileName::Join(plasmaDir, "sfx");
// Before we finish our path, make sure that directory EXISTS
plFileUtils::CreateDir( fullPath );
plFileSystem::CreateDir(fullPath);
// Now finish the path...
strcat( fullPath, keyName.c_str() );
fullPath = plFileName::Join(fullPath, keyName);
// Check filestamp
WIN32_FILE_ATTRIBUTE_DATA oldFileAttrib, newFileAttrib;
BOOL oldOK, newOK;
plFileInfo oldInfo(fileName);
plFileInfo newInfo(fullPath);
oldOK = GetFileAttributesEx( fileName, GetFileExInfoStandard, &oldFileAttrib );
newOK = GetFileAttributesEx( fullPath, GetFileExInfoStandard, &newFileAttrib );
if( oldOK && newOK )
if (oldInfo.Exists() && newInfo.Exists())
{
// Only copy if the file is newer
if( ::CompareFileTime( &oldFileAttrib.ftLastWriteTime, &newFileAttrib.ftLastWriteTime ) > 0 )
{
::CopyFile( fileName, fullPath, FALSE );
}
if (oldInfo.ModifyTime() > newInfo.ModifyTime())
plFileSystem::Copy(fileName, fullPath);
}
else
{
// Can't compare, so either there was an error or the target file doesn't exist. Copy no matter what.
::CopyFile( fileName, fullPath, FALSE );
plFileSystem::Copy(fileName, fullPath);
}
// Point to our new sound file
fileName = fullPath;
rfilename = fullPath;
}
// Additional info for the keyName--need some flag mangling, specifically for the left/right channel mangling
@ -672,12 +657,12 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file
else if( srcBufferFlags & plSoundBuffer::kOnlyRightChannel )
keyName += ":R";
key = srcNode->FindPageKey( plSoundBuffer::Index(), keyName );
key = srcNode->FindPageKey( plSoundBuffer::Index(), keyName );
if( key != nil )
return plSoundBuffer::ConvertNoRef( key->GetObjectPtr() );
// Not yet created, so make a new one
plSoundBuffer *buffer = new plSoundBuffer( fileName, srcBufferFlags );
plSoundBuffer *buffer = new plSoundBuffer( rfilename, srcBufferFlags );
if( !buffer->IsValid() )
{
// Invalid, so delete and return nil
@ -2258,29 +2243,18 @@ bool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
}
// Grab the buffer for this sound directly from the original source
const char *fileName = groupArray[ i ]->GetSoundFileName( kBaseSound );
plFileName fileName = groupArray[ i ]->GetSoundFileName( kBaseSound );
plSoundBuffer *buffer = new plSoundBuffer( fileName );
if( !buffer->IsValid() || !buffer->EnsureInternal() )
{
// OK, because some *cough* machines are completely stupid and don't load AssetMan scenes with
// AssetMan plugins, we need to do a really stupid fallback search to the current exporting directory.
const char *plasmaDir = plMaxConfig::GetClientPath();
plFileName plasmaDir = plMaxConfig::GetClientPath();
bool worked = false;
if( plasmaDir != nil )
if (plasmaDir.IsValid())
{
char newPath[ MAX_PATH ];
strcpy( newPath, plasmaDir );
strcat( newPath, "sfx\\" );
const char* c = strrchr( fileName, '\\' );
if( c == nil )
c = strrchr( fileName, '/' );
if( c == nil )
c = fileName;
else
c++;
strcat( newPath, c );
plFileName newPath = plFileName::Join(plasmaDir, "sfx", fileName.GetFileName());
// Got a path to try, so try it!
delete buffer;
@ -2292,7 +2266,7 @@ bool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
if( !worked )
{
char msg[ 512 ];
sprintf( msg, "The sound file %s cannot be loaded for component %s.", fileName, groupArray[ i ]->GetINode()->GetName() );
sprintf( msg, "The sound file %s cannot be loaded for component %s.", fileName.AsString().c_str(), groupArray[ i ]->GetINode()->GetName() );
IShowError( kSrcBufferInvalid, msg, baseNode->GetName(), pErrMsg );
delete buffer;
@ -2312,7 +2286,7 @@ bool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
{
char msg[ 512 ];
sprintf( msg, "The format for sound file %s does not match the format for the other grouped sounds on node %s. "
"Make sure the sounds are all the same format.", fileName, baseNode->GetName() );
"Make sure the sounds are all the same format.", fileName.AsString().c_str(), baseNode->GetName() );
IShowError( kMergeSourceFormatMismatch, msg, baseNode->GetName(), pErrMsg );
delete buffer;

View File

@ -65,6 +65,7 @@ class plMaxNode;
class plSoundBuffer;
class plSound;
class plAudioBaseComponentProc;
class plFileName;
namespace plAudioComp
{
@ -117,7 +118,7 @@ class plBaseSoundEmitterComponent : public plComponent
return -1;
}
static plSoundBuffer *GetSourceBuffer( const char *fileName, plMaxNode *node, uint32_t srcBufferFlags );
static plSoundBuffer *GetSourceBuffer( const plFileName &fileName, plMaxNode *node, uint32_t srcBufferFlags );
static bool LookupLatestAsset( const char *waveName, char *retPath, plErrorMsg *errMsg );
virtual void UpdateSoundFileSelection( void );
@ -177,7 +178,7 @@ class plBaseSoundEmitterComponent : public plComponent
virtual uint32_t ICalcSourceBufferFlags() const;
static plSoundBuffer *IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags );
static plSoundBuffer *IGetSourceBuffer( const plFileName &fileName, plMaxNode *srcNode, uint32_t srcBufferFlags );
plSoundBuffer *IProcessSourceBuffer( plMaxNode *maxNode, plErrorMsg *errMsg );

View File

@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "plgDispatch.h"
#include "plFile/hsFiles.h"
#include "hsTemplates.h"
#include "plComponent.h"
@ -1449,8 +1448,8 @@ void plGUIDialogProc::ILoadPages( HWND hWnd, IParamBlock2 *pb )
while( ( page = aged->GetNextPage() ) != nil )
{
int idx = ComboBox_AddString( hWnd, page->GetName() );
if( selPageName && stricmp( page->GetName(), selPageName ) == 0 )
int idx = ComboBox_AddString( hWnd, page->GetName().c_str() );
if( selPageName && page->GetName().CompareI( selPageName ) == 0 )
ComboBox_SetCurSel( hWnd, idx );
}
@ -1464,19 +1463,17 @@ BOOL plGUIDialogProc::DlgProc( TimeValue t, IParamMap2 *pmap, HWND hWnd, UINT ms
case WM_INITDIALOG:
// Load the age combo box
{
int i, idx, selIdx = 0;
HWND ageCombo = GetDlgItem( hWnd, IDC_GUIDLG_AGE );
hsTArray<char *> ageList;
int i, idx, selIdx = 0;
HWND ageCombo = GetDlgItem( hWnd, IDC_GUIDLG_AGE );
plAgeDescInterface::BuildAgeFileList( ageList );
hsTArray<plFileName> ageList = plAgeDescInterface::BuildAgeFileList();
ComboBox_ResetContent( ageCombo );
for( i = 0; i < ageList.GetCount(); i++ )
{
char ageName[ _MAX_FNAME ];
_splitpath( ageList[ i ], nil, nil, ageName, nil );
plString ageName = ageList[i].GetFileNameNoExt();
idx = ComboBox_AddString( ageCombo, ageName );
if( stricmp( ageName, pmap->GetParamBlock()->GetStr( plGUIDialogComponent::kRefAgeName ) ) == 0 )
idx = ComboBox_AddString( ageCombo, ageName.c_str() );
if( ageName.CompareI( pmap->GetParamBlock()->GetStr( plGUIDialogComponent::kRefAgeName ) ) == 0 )
{
selIdx = idx;
}

View File

@ -43,8 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "plCreatableIndex.h"
#include "plgDispatch.h"
#include "plFile/plFileUtils.h"
#include "plFile/hsFiles.h"
#include "plComponentReg.h"
#include "plMiscComponents.h"
@ -237,8 +235,8 @@ protected:
aged.SeekFirstPage();
while( ( page = aged.GetNextPage() ) != nil )
{
int idx = ComboBox_AddString(hPageCombo, page->GetName() );
if (curPage && !strcmp(page->GetName(), curPage))
int idx = ComboBox_AddString(hPageCombo, page->GetName().c_str() );
if (curPage && (page->GetName() == curPage))
ComboBox_SetCurSel(hPageCombo, idx);
ComboBox_SetItemData( hPageCombo, idx, (int)page->GetSeqSuffix() );
}
@ -260,8 +258,7 @@ protected:
HWND hAgeCombo = GetDlgItem(fhDlg, IDC_COMP_LOCATION_AGECOMBO);
IClearAges( hAgeCombo );
hsTArray<char *> ageFiles;
plAgeDescInterface::BuildAgeFileList( ageFiles );
hsTArray<plFileName> ageFiles = plAgeDescInterface::BuildAgeFileList();
const char *curAge = fPB->GetStr(plPageInfoComponent::kInfoAge);
if (!curAge || *curAge == '\0')
@ -269,14 +266,13 @@ protected:
for( int i = 0; i < ageFiles.GetCount(); i++ )
{
char ageName[_MAX_FNAME];
_splitpath( ageFiles[ i ], nil, nil, ageName, nil );
plString ageName = ageFiles[i].GetFileNameNoExt();
int idx = ComboBox_AddString( hAgeCombo, ageName );
int idx = ComboBox_AddString( hAgeCombo, ageName.c_str() );
// Store the pathas the item data for later (so don't free it yet!)
ComboBox_SetItemData( hAgeCombo, idx, (LPARAM)ageFiles[ i ] );
ComboBox_SetItemData( hAgeCombo, idx, (LPARAM)ageFiles[i].AsString().c_str() );
if( !strcmp( ageName, curAge ) )
if (ageName == curAge)
ComboBox_SetCurSel( hAgeCombo, idx );
}
@ -576,33 +572,32 @@ const char *plPageInfoComponent::GetAgeName()
// Checks in assetMan to make sure we have the latest .age file to export
// with.
void plPageInfoComponent::IVerifyLatestAgeAsset( const char *ageName, const char *localPath, plErrorMsg *errMsg )
void plPageInfoComponent::IVerifyLatestAgeAsset( const plString &ageName, const plFileName &localPath, plErrorMsg *errMsg )
{
#ifdef MAXASS_AVAILABLE
char ageFileName[ MAX_PATH ], assetPath[ MAX_PATH ];
plFileName ageFileName, assetPath;
MaxAssInterface *assetMan = GetMaxAssInterface();
if( assetMan == nil )
return; // No AssetMan available
// Try to find it in assetMan
sprintf( ageFileName, "%s.age", ageName );
ageFileName = ageName + ".age";
jvUniqueId assetId;
if (assetMan->FindAssetByFilename(ageFileName, assetId))
if (assetMan->FindAssetByFilename(ageFileName.AsString().c_str(), assetId))
{
// Get the latest version
if (!assetMan->GetLatestVersionFile(assetId, assetPath, sizeof(assetPath)))
{
errMsg->Set( true, "PageInfo Convert Error",
"Unable to update age file for '%s' because AssetMan was unable to get the latest version. Using local copy instead.", ageName ).Show();
"Unable to update age file for '%s' because AssetMan was unable to get the latest version. Using local copy instead.", ageName.c_str() ).Show();
errMsg->Set( false );
return;
}
// Got the latest version, just copy over and roll!
plFileUtils::RemoveFile( localPath );
plFileUtils::FileCopy( assetPath, localPath );
plFileSystem::Unlink(localPath);
plFileSystem::Copy(assetPath, localPath);
}
else
{
@ -625,10 +620,8 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg )
// Mark us as updated
fCompPB->SetValue( kRefVolatile_PageInfoUpdated, 0, (int)true );
char path[MAX_PATH];
const char *ageFolder = plPageInfoUtils::GetAgeFolder();
if( ageFolder == nil )
plFileName ageFolder = plPageInfoUtils::GetAgeFolder();
if (!ageFolder.IsValid())
{
errMsg->Set( true,
"PageInfo Convert Error",
@ -653,7 +646,7 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg )
fCompPB->SetValue( kInfoSeqSuffix, 0, 0 );
return;
}
sprintf(path, "%s%s.age", ageFolder, curAge);
plFileName path = plFileName::Join(ageFolder, plString::Format("%s.age", curAge));
IVerifyLatestAgeAsset( curAge, path, errMsg );
@ -699,12 +692,12 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg )
while( ( page = aged.GetNextPage() ) != nil )
{
if( stricmp( page->GetName(), compPBPageName ) == 0 )
if( page->GetName().CompareI( compPBPageName ) == 0 )
{
fCompPB->SetValue( kInfoSeqSuffix, 0, (int)page->GetSeqSuffix() );
// Also re-copy the page name, just to make sure the case is correct
fCompPB->SetValue( kInfoPage, 0, (char *)page->GetName() );
fCompPB->SetValue( kInfoPage, 0, (const char *)page->GetName().c_str() );
return;
}
}
@ -720,28 +713,20 @@ void plPageInfoComponent::IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg )
fCompPB->SetValue( kInfoSeqSuffix, 0, 0 );
}
const char *plPageInfoUtils::GetAgeFolder()
plFileName plPageInfoUtils::GetAgeFolder()
{
static char ageFolder[MAX_PATH];
static bool initialized = false;
static plFileName ageFolder;
if (!initialized)
if (!ageFolder.IsValid())
{
initialized = true;
ageFolder[0] = '\0';
plFileName plasmaPath = plMaxConfig::GetClientPath();
if (!plasmaPath.IsValid())
return "";
const char *plasmaPath = plMaxConfig::GetClientPath();
if (!plasmaPath)
return nil;
strcpy(ageFolder, plasmaPath);
strcat(ageFolder, plAgeDescription::kAgeDescPath);
ageFolder = plFileName::Join(plasmaPath, plAgeDescription::kAgeDescPath);
}
if (ageFolder[0] != '\0')
return ageFolder;
else
return nil;
return ageFolder;
}
int32_t plPageInfoUtils::CombineSeqNum( int prefix, int suffix )
@ -789,7 +774,7 @@ int32_t plPageInfoUtils::GetSeqNumFromAgeDesc( const char *ageName, const char
aged->SeekFirstPage();
while( ( page = aged->GetNextPage() ) != nil )
{
if( stricmp( pageName, page->GetName() ) == 0 )
if (page->GetName().CompareI(pageName) == 0)
{
seqSuffix = page->GetSeqSuffix();
break;
@ -801,18 +786,14 @@ int32_t plPageInfoUtils::GetSeqNumFromAgeDesc( const char *ageName, const char
return CombineSeqNum( seqPrefix, seqSuffix );
}
plAgeDescription *plPageInfoUtils::GetAgeDesc( const char *ageName )
plAgeDescription *plPageInfoUtils::GetAgeDesc( const plString &ageName )
{
char path[ MAX_PATH ];
const char *ageFolder = plPageInfoUtils::GetAgeFolder();
if( ageFolder == nil || ageName == nil )
plFileName ageFolder = plPageInfoUtils::GetAgeFolder();
if (!ageFolder.IsValid() || ageName.IsNull())
return nil;
sprintf( path, "%s%s.age", ageFolder, ageName );
hsUNIXStream s;
if( !s.Open( path ) )
if (!s.Open(plFileName::Join(ageFolder, ageName + ".age")))
return nil;
// Create and read the age desc

View File

@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define CIRCLE_CAM_CID Class_ID(0x66f85282, 0x4daa1b8e)
#define IMAGE_LIB_CID Class_ID(0x736c18d3, 0x6a6d5dde)
class plFileName;
class plAgeDescription;
class plComponentBase;
struct NotifyInfo;
@ -60,12 +61,12 @@ const char* LocCompGetPage(plComponentBase* comp);
namespace plPageInfoUtils
{
const char *GetAgeFolder();
int32_t GetSeqNumFromAgeDesc( const char *ageName, const char *pageName );
int32_t CombineSeqNum( int prefix, int suffix );
int32_t GetCommonSeqNumFromNormal( int32_t normalSeqNumber, int whichCommonPage );
plFileName GetAgeFolder();
int32_t GetSeqNumFromAgeDesc( const char *ageName, const char *pageName );
int32_t CombineSeqNum( int prefix, int suffix );
int32_t GetCommonSeqNumFromNormal( int32_t normalSeqNumber, int whichCommonPage );
plAgeDescription *GetAgeDesc( const char *ageName );
plAgeDescription *GetAgeDesc( const plString &ageName );
};
// PageInfo component definition, here so other components can get to the static function(s)
@ -76,8 +77,8 @@ protected:
bool fItinerant;
static char fCurrExportedAge[ 256 ];
void IVerifyLatestAgeAsset( const char *ageName, const char *localPath, plErrorMsg *errMsg );
void IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg );
void IVerifyLatestAgeAsset( const plString &ageName, const plFileName &localPath, plErrorMsg *errMsg );
void IUpdateSeqNumbersFromAgeFile( plErrorMsg *errMsg );
public:
plPageInfoComponent();

View File

@ -41,7 +41,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "HeadSpin.h"
#include "plFile/hsFiles.h"
#include "hsResMgr.h"
#include "plComponentBase.h"
@ -318,30 +317,23 @@ void plResponderLinkProc::ILoadAgeFilenamesCombo(HWND hWnd, IParamBlock2 *pb)
SendMessage(hAge, CB_RESETCONTENT, 0, 0);
// Get the path to the description folder
char agePath[MAX_PATH];
const char *plasmaPath = plMaxConfig::GetClientPath();
if (!plasmaPath)
plFileName plasmaPath = plMaxConfig::GetClientPath();
if (!plasmaPath.IsValid())
return;
strcpy(agePath, plasmaPath);
strcat(agePath, plAgeDescription::kAgeDescPath);
plFileName agePath = plFileName::Join(plasmaPath, plAgeDescription::kAgeDescPath);
const char *savedName = pb->GetStr(kLinkAgeFilename);
if (!savedName)
savedName = "";
// Iterate through the age descriptions
hsFolderIterator ageFolder(agePath);
while (ageFolder.NextFileSuffix(".age"))
std::vector<plFileName> ages = plFileSystem::ListDir(agePath, "*.age");
for (auto iter = ages.begin(); iter != ages.end(); ++iter)
{
char ageFile[MAX_PATH];
ageFolder.GetPathAndName(ageFile);
int idx = SendMessage(hAge, CB_ADDSTRING, 0, (LPARAM)iter->GetFileNameNoExt().c_str());
char name[_MAX_FNAME];
_splitpath(ageFile, nil, nil, name, nil);
int idx = SendMessage(hAge, CB_ADDSTRING, 0, (LPARAM)name);
if (strcmp(name, savedName) == 0)
if (iter->GetFileNameNoExt() == savedName)
SendMessage(hAge, CB_SETCURSEL, idx, 0);
}
}
@ -355,30 +347,22 @@ void plResponderLinkProc::ILoadParentAgeFilenamesCombo(HWND hWnd, IParamBlock2 *
SendMessage(hAge, CB_ADDSTRING, 0, (LPARAM)"<None>");
// Get the path to the description folder
char agePath[MAX_PATH];
const char *plasmaPath = plMaxConfig::GetClientPath();
if (!plasmaPath)
plFileName plasmaPath = plMaxConfig::GetClientPath();
if (!plasmaPath.IsValid())
return;
strcpy(agePath, plasmaPath);
strcat(agePath, plAgeDescription::kAgeDescPath);
plFileName agePath = plFileName::Join(plasmaPath, plAgeDescription::kAgeDescPath);
const char *savedName = pb->GetStr(kLinkParentAgeFilename);
if (!savedName)
savedName = "<None>";
// Iterate through the age descriptions
hsFolderIterator ageFolder(agePath);
while (ageFolder.NextFileSuffix(".age"))
std::vector<plFileName> ages = plFileSystem::ListDir(agePath, "*.age");
for (auto iter = ages.begin(); iter != ages.end(); ++iter)
{
char ageFile[MAX_PATH];
ageFolder.GetPathAndName(ageFile);
int idx = SendMessage(hAge, CB_ADDSTRING, 0, (LPARAM)iter->GetFileNameNoExt().c_str());
char name[_MAX_FNAME];
_splitpath(ageFile, nil, nil, name, nil);
int idx = SendMessage(hAge, CB_ADDSTRING, 0, (LPARAM)name);
if (strcmp(name, savedName) == 0)
if (iter->GetFileNameNoExt() == savedName)
SendMessage(hAge, CB_SETCURSEL, idx, 0);
}
}