diff --git a/cwFileSys.cpp b/cwFileSys.cpp index 9325207..788e1cb 100644 --- a/cwFileSys.cpp +++ b/cwFileSys.cpp @@ -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; }