mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 20:53:52 +00:00
User data directory location getter.
This commit is contained in:
parent
36942a5ddb
commit
9e76ddb9fd
@ -117,7 +117,6 @@ const char* GetSavePath( const char* file )
|
|||||||
|
|
||||||
const char* GetSavePath( const char* program, uint64_t time, const char* file, bool create )
|
const char* GetSavePath( const char* program, uint64_t time, const char* file, bool create )
|
||||||
{
|
{
|
||||||
assert( file && *file );
|
|
||||||
assert( program && *program );
|
assert( program && *program );
|
||||||
|
|
||||||
enum { Pool = 8 };
|
enum { Pool = 8 };
|
||||||
@ -195,9 +194,16 @@ const char* GetSavePath( const char* program, uint64_t time, const char* file, b
|
|||||||
assert( status );
|
assert( status );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto fsz = strlen( file );
|
if( file )
|
||||||
assert( sz + fsz < MaxPath );
|
{
|
||||||
memcpy( buf+sz, file, fsz+1 );
|
const auto fsz = strlen( file );
|
||||||
|
assert( sz + fsz < MaxPath );
|
||||||
|
memcpy( buf+sz, file, fsz+1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf[sz] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -236,4 +236,10 @@ void UserData::Remove( const char* filename )
|
|||||||
unlink( path );
|
unlink( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* UserData::GetConfigLocation() const
|
||||||
|
{
|
||||||
|
assert( Valid() );
|
||||||
|
return GetSavePath( m_program.c_str(), m_time, nullptr, false );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
void LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data );
|
void LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data );
|
||||||
void SaveAnnotations( const std::vector<std::unique_ptr<Annotation>>& data );
|
void SaveAnnotations( const std::vector<std::unique_ptr<Annotation>>& data );
|
||||||
|
|
||||||
|
const char* GetConfigLocation() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE* OpenFile( const char* filename, bool write );
|
FILE* OpenFile( const char* filename, bool write );
|
||||||
void Remove( const char* filename );
|
void Remove( const char* filename );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user