diff --git a/cwFileSys.cpp b/cwFileSys.cpp index 7d16230..b4b035f 100644 --- a/cwFileSys.cpp +++ b/cwFileSys.cpp @@ -140,9 +140,11 @@ char* cw::filesys::vMakeFn( const char* dir, const char* fn, const char* ext, va n += strlen(ext) + 1; // add 1 for period // get length of all var args dir's - while( (dp = va_arg(vl,const char*)) != nullptr ) + while( (dp = va_arg(vl_t,const char*)) != nullptr ) n += strlen(dp) + 1; // add 1 for ending sep + va_end(vl_t); + // add 1 for terminating zero and allocate memory if((rp = mem::allocZ( n+1 )) == nullptr ) @@ -151,8 +153,6 @@ char* cw::filesys::vMakeFn( const char* dir, const char* fn, const char* ext, va goto errLabel; } - va_copy(vl,vl_t); - rp[n] = 0; rp[0] = 0; @@ -205,6 +205,43 @@ char* cw::filesys::makeFn( const char* dir, const char* fn, const char* ext, .. return fnOut; } + +char* cw::filesys::vMakeVersionedFn(const char* dir, const char* fn_prefix, const char* ext, va_list vl ) +{ + char* fn = nullptr; + const unsigned max_version = 1024; + + for(unsigned version = 0; version