diff --git a/server/TracyStorage.cpp b/server/TracyStorage.cpp index 9fda5f28..8ba4e98a 100644 --- a/server/TracyStorage.cpp +++ b/server/TracyStorage.cpp @@ -117,7 +117,6 @@ const char* GetSavePath( const char* file ) const char* GetSavePath( const char* program, uint64_t time, const char* file, bool create ) { - assert( file && *file ); assert( program && *program ); enum { Pool = 8 }; @@ -195,9 +194,16 @@ const char* GetSavePath( const char* program, uint64_t time, const char* file, b assert( status ); } - const auto fsz = strlen( file ); - assert( sz + fsz < MaxPath ); - memcpy( buf+sz, file, fsz+1 ); + if( file ) + { + const auto fsz = strlen( file ); + assert( sz + fsz < MaxPath ); + memcpy( buf+sz, file, fsz+1 ); + } + else + { + buf[sz] = '\0'; + } return buf; } diff --git a/server/TracyUserData.cpp b/server/TracyUserData.cpp index 94984751..2837f257 100644 --- a/server/TracyUserData.cpp +++ b/server/TracyUserData.cpp @@ -236,4 +236,10 @@ void UserData::Remove( const char* filename ) unlink( path ); } +const char* UserData::GetConfigLocation() const +{ + assert( Valid() ); + return GetSavePath( m_program.c_str(), m_time, nullptr, false ); +} + } diff --git a/server/TracyUserData.hpp b/server/TracyUserData.hpp index b1d04c3a..f355f708 100644 --- a/server/TracyUserData.hpp +++ b/server/TracyUserData.hpp @@ -32,6 +32,8 @@ public: void LoadAnnotations( std::vector>& data ); void SaveAnnotations( const std::vector>& data ); + const char* GetConfigLocation() const; + private: FILE* OpenFile( const char* filename, bool write ); void Remove( const char* filename );