~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/library.cc

  • Committer: lbieber
  • Date: 2010-10-07 14:55:42 UTC
  • mfrom: (1813.2.17 boost-fs-path-work)
  • mto: This revision was merged to the branch mainline in revision 1820.
  • Revision ID: lbieber@orisndriz08-20101007145542-fiwu5dd53lfrd0hr
Merge Monty - Bug 655294: load_data() function returns null if file is invalid 
Merge Monty - Bug 655342: select into outfile creates a garbage file on no results

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <cerrno>
25
25
#include <string>
26
26
 
 
27
#include <boost/filesystem.hpp>
 
28
 
27
29
#include "drizzled/plugin.h"
28
30
#include "drizzled/definitions.h"
29
31
#include "drizzled/error.h"
31
33
#include "drizzled/module/library.h"
32
34
 
33
35
using namespace std;
 
36
namespace fs=boost::filesystem;
34
37
 
35
38
namespace drizzled
36
39
{
50
53
  */
51
54
}
52
55
 
53
 
const string module::Library::getLibraryPath(const string &plugin_name)
 
56
const fs::path module::Library::getLibraryPath(const string &plugin_name)
54
57
{
55
 
  /* Compile dll path */
56
 
  string dlpath;
57
 
  dlpath.reserve(FN_REFLEN);
58
 
  dlpath.append(opt_plugin_dir);
59
 
  dlpath.append("/");
60
 
  dlpath.append("lib");
61
 
  dlpath.append(plugin_name);
62
 
  dlpath.append("_plugin");
 
58
  string plugin_lib_name("lib");
 
59
  plugin_lib_name.append(plugin_name);
 
60
  plugin_lib_name.append("_plugin");
63
61
#if defined(TARGET_OS_OSX)
64
 
  dlpath.append(".dylib");
 
62
  plugin_lib_name.append(".dylib");
65
63
#else
66
 
  dlpath.append(".so");
 
64
  plugin_lib_name.append(".so");
67
65
#endif
68
 
  return dlpath;
 
66
 
 
67
  /* Compile dll path */
 
68
  return plugin_dir / plugin_lib_name;
69
69
}
70
70
 
71
71
module::Library *module::Library::loadLibrary(const string &plugin_name, bool builtin)
102
102
  else
103
103
  {
104
104
  /* Open new dll handle */
105
 
    dlpath.assign(Library::getLibraryPath(plugin_name));
 
105
    dlpath.assign(Library::getLibraryPath(plugin_name).file_string());
106
106
    handle= dlopen(dlpath.c_str(), RTLD_NOW|RTLD_GLOBAL);
107
107
    if (handle == NULL)
108
108
    {