Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
path-builder.cc
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "util/path-builder.h"
16 
17 #include <sstream>
18 #include <stdlib.h>
19 
20 #include "common/names.h"
21 
22 using namespace impala;
23 
24 const char* PathBuilder::impala_home_;
25 
27  if (impala_home_ != NULL) return;
28  impala_home_ = getenv("IMPALA_HOME");
29 }
30 
31 void PathBuilder::GetFullPath(const string& path, string* full_path) {
33  stringstream s;
34  s << impala_home_ << "/" << path;
35  *full_path = s.str();
36 }
37 
38 void PathBuilder::GetFullBuildPath(const string& path, string* full_path) {
40  stringstream s;
41 #ifdef NDEBUG
42  s << impala_home_ << "/be/build/release/" << path;
43 #else
44  s << impala_home_ << "/be/build/debug/" << path;
45 #endif
46  *full_path = s.str();
47 }
string path("/usr/lib/sasl2:/usr/lib64/sasl2:/usr/local/lib/sasl2:/usr/lib/x86_64-linux-gnu/sasl2")
static void GetFullBuildPath(const std::string &path, std::string *full_path)
Sets full_path to <IMPALA_HOME>/<build><debug or="" release>="">/path.
Definition: path-builder.cc:38
static void LoadImpalaHome()
Load impala_home_ if it is not already loaded.
Definition: path-builder.cc:26
static void GetFullPath(const std::string &path, std::string *full_path)
Sets full_path to <IMPALA_HOME>/path.
Definition: path-builder.cc:31
static const char * impala_home_
Cache of env['IMPALA_HOME'].
Definition: path-builder.h:34