1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00
This commit is contained in:
David Hill
2018-09-19 14:38:25 -05:00
parent 6911730113
commit c7d3dc173e
3 changed files with 49 additions and 0 deletions

View File

@@ -188,6 +188,9 @@ int main(int argc, char* argv[])
string ccHistoryFile = HOME + "/.cc_history"; string ccHistoryFile = HOME + "/.cc_history";
cout << startup::StartUp::installDir();
cout << startup::StartUp::tmpDir();
string cf = startup::StartUp::installDir() + "/etc/" + ConsoleCmdsFile; string cf = startup::StartUp::installDir() + "/etc/" + ConsoleCmdsFile;
fConfig = Config::makeConfig(cf); fConfig = Config::makeConfig(cf);

View File

@@ -71,6 +71,49 @@ const string StartUp::installDir()
return *fInstallDirp; return *fInstallDirp;
} }
/* static */
mutex StartUp::fTmpDirLock;
/* static */
string* StartUp::fTmpDirp = 0;
/* static */
const string StartUp::tmpDir()
{
mutex::scoped_lock lk(fTmpDirLock);
if (fTmpDirp)
return *fTmpDirp;
#ifdef _MSC_VER
fTmpDirp = new string("C:\\Calpont\Tmp");
string cfStr = IDBreadRegistry("");
if (!cfStr.empty())
*fTmpDirp = cfStr;
#else
fTmpDirp = new string("/tmp");
//See if we can figure out the tmp dir in Linux...
//1. env var COLUMNSTORE_INSTALL_DIR
const char* p = 0;
p = getenv("COLUMNSTORE_INSTALL_DIR");
if (p && *p)
{
string homedir = "/";
char* p = getenv("HOME");
if (p && *p)
homedir = p;
*fTmpDirp = homedir + "/tmp";
}
#endif
return *fTmpDirp;
}
} }
// vim:ts=4 sw=4: // vim:ts=4 sw=4:

View File

@@ -39,6 +39,7 @@ public:
~StartUp() {} ~StartUp() {}
static const std::string installDir(); static const std::string installDir();
static const std::string tmpDir();
private: private:
StartUp(const StartUp& rhs); StartUp(const StartUp& rhs);
@@ -46,6 +47,8 @@ private:
static boost::mutex fInstallDirLock; static boost::mutex fInstallDirLock;
static std::string* fInstallDirp; static std::string* fInstallDirp;
static boost::mutex fTmpDirLock;
static std::string* fTmpDirp;
}; };
} }