Back to index

nordugrid-arc-nox  1.1.0~rc6
Static Public Member Functions | Static Private Member Functions
Arc::ArcLocation Class Reference

Determines ARC installation location. More...

#include <ArcLocation.h>

List of all members.

Static Public Member Functions

static void Init (std::string path)
 Initializes location information.
static const std::string & Get ()
 Returns ARC installation location.
static std::list< std::string > GetPlugins ()
 Returns ARC plugins directory location.

Static Private Member Functions

static std::string & location (void)

Detailed Description

Determines ARC installation location.

Definition at line 12 of file ArcLocation.h.


Member Function Documentation

const std::string & Arc::ArcLocation::Get ( ) [static]

Returns ARC installation location.

Definition at line 56 of file ArcLocation.cpp.

                                    {
    if (location().empty())
      Init("");
    return location();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

std::list< std::string > Arc::ArcLocation::GetPlugins ( ) [static]

Returns ARC plugins directory location.

Main source is value of variable ARC_PLUGIN_PATH, otherwise path is derived from installation location.

Definition at line 63 of file ArcLocation.cpp.

                                             {
    std::list<std::string> plist;
    std::string arcpluginpath = GetEnv("ARC_PLUGIN_PATH");
    if (!arcpluginpath.empty()) {
      std::string::size_type pos = 0;
      while (pos != std::string::npos) {
        std::string::size_type pos2 = arcpluginpath.find(G_SEARCHPATH_SEPARATOR, pos);
        plist.push_back(pos2 == std::string::npos ?
                        arcpluginpath.substr(pos) :
                        arcpluginpath.substr(pos, pos2 - pos));
        pos = pos2;
        if (pos != std::string::npos)
          pos++;
      }
    }
    else
      plist.push_back(Get() + G_DIR_SEPARATOR_S + PKGLIBSUBDIR);
    return plist;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::ArcLocation::Init ( std::string  path) [static]

Initializes location information.

Main source is value of variable ARC_LOCATION, otherwise path to executable provided in is used. If nothing works then warning message is sent to logger and initial installation prefix is used.

Definition at line 26 of file ArcLocation.cpp.

                                       {
    location().clear();
    location() = GetEnv("ARC_LOCATION");
    if (location().empty() && !path.empty()) {
      if (path.rfind(G_DIR_SEPARATOR_S) == std::string::npos)
        path = Glib::find_program_in_path(path);
      if (path.substr(0, 2) == std::string(".") + G_DIR_SEPARATOR_S) {
        char cwd[PATH_MAX];
        if (getcwd(cwd, PATH_MAX))
          path.replace(0, 1, cwd);
      }
      std::string::size_type pos = path.rfind(G_DIR_SEPARATOR_S);
      if (pos != std::string::npos && pos > 0) {
        pos = path.rfind(G_DIR_SEPARATOR_S, pos - 1);
        if (pos != std::string::npos)
          location() = path.substr(0, pos);
      }
    }
    if (location().empty()) {
      Logger::getRootLogger().msg(WARNING,
                                  "Can not determine the install location. "
                                  "Using %s. Please set ARC_LOCATION "
                                  "if this is not correct.", INSTPREFIX);
      location() = INSTPREFIX;
    }
#ifdef ENABLE_NLS
    bindtextdomain(PACKAGE, (location() + G_DIR_SEPARATOR_S + "share" + G_DIR_SEPARATOR_S "locale").c_str());
#endif
  }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string & Arc::ArcLocation::location ( void  ) [static, private]

Definition at line 21 of file ArcLocation.cpp.

                                       {
    static std::string* location_ = new std::string;
    return *location_;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: