cwFileSys.cpp : Automatically expand the base directory in makeFn().
This commit is contained in:
parent
dcfa97d320
commit
8670fdca8c
@ -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;
|
rc_t rc = kOkRC;
|
||||||
|
char* dir = nullptr;
|
||||||
char* rp = nullptr;
|
char* rp = nullptr;
|
||||||
const char* dp = nullptr;
|
const char* dp = nullptr;
|
||||||
unsigned n = 0;
|
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_list vl_t;
|
||||||
va_copy(vl_t,vl);
|
va_copy(vl_t,vl);
|
||||||
|
|
||||||
|
if( dir0 != nullptr )
|
||||||
|
dir = expandPath(dir0);
|
||||||
|
|
||||||
// get prefix directory length
|
// get prefix directory length
|
||||||
if( dir != nullptr )
|
if( dir != nullptr )
|
||||||
n += strlen(dir) + 1; // add 1 for ending sep
|
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 )
|
if( rc != kOkRC && rp != nullptr )
|
||||||
mem::release( rp );
|
mem::release( rp );
|
||||||
|
|
||||||
|
mem::release(dir);
|
||||||
|
|
||||||
return rp;
|
return rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user