Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2019-07-26 23:42:50 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2019-07-26 23:42:50 +0300
commit3ec1771f5aa8b2a3ac6b5e434935678e228adab1 (patch)
tree25bbbc6622968a9265de5d8b19a169a2578cf4f5 /server/TracyStorage.cpp
parentc1b70c6519df42efb7e80f48dfc6c9c53045a0df (diff)
Move config directory retrieval to a separate function.
Diffstat (limited to 'server/TracyStorage.cpp')
-rw-r--r--server/TracyStorage.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/server/TracyStorage.cpp b/server/TracyStorage.cpp
index e7b1a116..41a0d3d1 100644
--- a/server/TracyStorage.cpp
+++ b/server/TracyStorage.cpp
@@ -50,18 +50,11 @@ static bool CreateDirStruct( const std::string& path )
return true;
}
-const char* GetSavePath( const char* file )
+static void GetConfigDirectory( char* buf, size_t& sz )
{
- enum { Pool = 8 };
- enum { MaxPath = 512 };
- static char bufpool[Pool][MaxPath];
- static int bufsel = 0;
- char* buf = bufpool[bufsel];
- bufsel = ( bufsel + 1 ) % Pool;
-
#ifdef _WIN32
auto path = getenv( "APPDATA" );
- auto sz = strlen( path );
+ sz = strlen( path );
memcpy( buf, path, sz );
for( size_t i=0; i<sz; i++ )
@@ -73,7 +66,6 @@ const char* GetSavePath( const char* file )
}
#else
auto path = getenv( "XDG_CONFIG_HOME" );
- size_t sz;
if( path && *path )
{
sz = strlen( path );
@@ -90,6 +82,19 @@ const char* GetSavePath( const char* file )
sz += 8;
}
#endif
+}
+
+const char* GetSavePath( const char* file )
+{
+ enum { Pool = 8 };
+ enum { MaxPath = 512 };
+ static char bufpool[Pool][MaxPath];
+ static int bufsel = 0;
+ char* buf = bufpool[bufsel];
+ bufsel = ( bufsel + 1 ) % Pool;
+
+ size_t sz;
+ GetConfigDirectory( buf, sz );
memcpy( buf+sz, "/tracy/", 8 );
sz += 7;