cwFileSys.cpp : Automatically expand the base directory in makeFn().

This commit is contained in:
kevin 2023-05-27 15:55:46 -04:00
parent dcfa97d320
commit 8670fdca8c

View File

@ -126,9 +126,10 @@ bool cw::filesys::isLink( const char* fnStr )
char* cw::filesys::vMakeFn( const char* dir, const char* fn, const char* ext, va_list vl )
char* cw::filesys::vMakeFn( const char* dir0, const char* fn, const char* ext, va_list vl )
{
rc_t rc = kOkRC;
char* dir = nullptr;
char* rp = nullptr;
const char* dp = nullptr;
unsigned n = 0;
@ -137,6 +138,9 @@ char* cw::filesys::vMakeFn( const char* dir, const char* fn, const char* ext, va
va_list vl_t;
va_copy(vl_t,vl);
if( dir0 != nullptr )
dir = expandPath(dir0);
// get prefix directory length
if( dir != nullptr )
n += strlen(dir) + 1; // add 1 for ending sep
@ -202,6 +206,8 @@ char* cw::filesys::vMakeFn( const char* dir, const char* fn, const char* ext, va
if( rc != kOkRC && rp != nullptr )
mem::release( rp );
mem::release(dir);
return rp;
}