瀏覽代碼

Merge branches 'add-ctkScopedCurrentDir' and 'update-current-path-ctkAbstractPluginFactory'

* add-ctkScopedCurrentDir:
  Update comment and fix typo

* update-current-path-ctkAbstractPluginFactory:
  Use ctkScopedCurrentDir in ctkFactoryPluginItem::load()
Jean-Christophe Fillion-Robin 13 年之前
父節點
當前提交
133fc3860b
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 2 0
      Libs/Core/ctkAbstractPluginFactory.tpp
  2. 2 2
      Libs/Core/ctkScopedCurrentDir.h

+ 2 - 0
Libs/Core/ctkAbstractPluginFactory.tpp

@@ -23,6 +23,7 @@
 
 // CTK includes
 #include "ctkAbstractPluginFactory.h"
+#include "ctkScopedCurrentDir.h"
 
 // QT includes
 #include <QPluginLoader>
@@ -43,6 +44,7 @@ ctkFactoryPluginItem<BaseClassType>::ctkFactoryPluginItem(const QString& _path)
 template<typename BaseClassType>
 bool ctkFactoryPluginItem<BaseClassType>::load()
 {
+  ctkScopedCurrentDir scopedCurrentDir(QFileInfo(this->path()).path());
   this->Loader.setFileName(this->path());
   return this->Loader.load();
 }

+ 2 - 2
Libs/Core/ctkScopedCurrentDir.h

@@ -36,8 +36,8 @@ class ctkScopedCurrentDirPrivate;
 /// This is particulary useful in case a plugin and its dependent libraries should be loaded from
 /// a known directory.
 /// Indeed, changing the application PATH, LD_LIBRARY_PATH or DYLD_LIBRARY_PATH within the current
-/// process won't have the desired effect. The loader check for these variable once when the process
-/// starts.
+/// process won't have the desired effect. The loader checks for these variables only once when
+/// the process starts.
 /// \sa http://stackoverflow.com/questions/856116/changing-ld-library-path-at-runtime-for-ctypes
 /// \sa http://stackoverflow.com/questions/1178094/change-current-process-environment
 ///