MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / find_xdg_config

Function find_xdg_config

modules/dasSQLITE/sqlite/shell.c:26717–26742  ·  view source on GitHub ↗

** On non-Windows platforms, look for $XDG_CONFIG_HOME. ** If ${XDG_CONFIG_HOME}/sqlite3/sqliterc is found, return ** the path to it, else return 0. The result is cached for ** subsequent calls. */

Source from the content-addressed store, hash-verified

26715** subsequent calls.
26716*/
26717static const char *find_xdg_config(void){
26718#if defined(_WIN32) || defined(WIN32) || defined(_WIN32_WCE) \
26719 || defined(__RTP__) || defined(_WRS_KERNEL)
26720 return 0;
26721#else
26722 static int alreadyTried = 0;
26723 static char *zConfig = 0;
26724 const char *zXdgHome;
26725
26726 if( alreadyTried!=0 ){
26727 return zConfig;
26728 }
26729 alreadyTried = 1;
26730 zXdgHome = getenv("XDG_CONFIG_HOME");
26731 if( zXdgHome==0 ){
26732 return 0;
26733 }
26734 zConfig = sqlite3_mprintf("%s/sqlite3/sqliterc", zXdgHome);
26735 shell_check_oom(zConfig);
26736 if( access(zConfig,0)!=0 ){
26737 sqlite3_free(zConfig);
26738 zConfig = 0;
26739 }
26740 return zConfig;
26741#endif
26742}
26743
26744/*
26745** Read input from the file given by sqliterc_override. Or if that

Callers 1

process_sqlitercFunction · 0.85

Calls 2

shell_check_oomFunction · 0.85
accessFunction · 0.85

Tested by

no test coverage detected