Functions

SplitFilename - Split a filename into its components

These function is used to extract the path, filename and/or extension out of a fully-qualified path name. More...

Functions

CoreExport void  SplitFilename (const CStr &name, CStr *p, CStr *f, CStr *e)
  SplitFilename (CStr* version)
CoreExport void  SplitFilename (LPCSTR name, LPSTR p, LPSTR f, LPSTR e)
  SplitFilename (char* version)
CoreExport void  SplitFilename (const WStr &name, WStr *p, WStr *f, WStr *e)
  SplitFilename (WStr* version)
CoreExport void  SplitFilename (LPCWSTR name, LPWSTR p, LPWSTR f, LPWSTR e)
  SplitFilename (wchar_t* version)

Detailed Description

These function is used to extract the path, filename and/or extension out of a fully-qualified path name.

Pass in NULL for components which you do not require.

Note that SplitFilename will also support being passed a GUID string representing an asset. Example: "{B5B12976-3C00-475A-A619-CE0C76BD8483}" If the IAssetManager can find an asset corresponding to this string, SplitFilename will use the filename of this asset.

    {
        CStr p, f, e;
        CStr name("c:\\mydir\\myfile.txt");
    
        SplitFilename(name, &p, &f, &e);
    
        // p now contains "c:\\mydir"
        // f now contains "myfile"
        // e now contains ".txt"
    }

    {
        WStr p;
        WStr name(L"c:\\mydir\\myfile.txt");

        SplitFilename(name, &p, NULL, NULL);    

        // p now contains L"c:\\mydir"
    }

    {
        wchar_t file[MAX_PATH];

        SplitFilename(L"c:\\mydir\\myfile.txt", NULL, file, NULL);

        // file now contains L"myfile"
    }
Parameters:
[in] name Full pathname, cannot be NULL.
[out] p Extracted path name, with directory. Pass NULL if you do not need it.
[out] f Extracted filename, without extension. Pass NULL if you do not need it.
[out] e Extracted extension. Pass NULL if you do not need it.

Function Documentation

CoreExport void SplitFilename ( const CStr name,
CStr p,
CStr f,
CStr e 
)

SplitFilename (CStr* version)

CoreExport void SplitFilename ( LPCSTR  name,
LPSTR  p,
LPSTR  f,
LPSTR  e 
)

SplitFilename (char* version)

CoreExport void SplitFilename ( const WStr name,
WStr p,
WStr f,
WStr e 
)

SplitFilename (WStr* version)

CoreExport void SplitFilename ( LPCWSTR  name,
LPWSTR  p,
LPWSTR  f,
LPWSTR  e 
)

SplitFilename (wchar_t* version)