[PATCH] deployment: make loadLibrary respect absolute paths

---
deployment/ComponentLoader.cpp | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/deployment/ComponentLoader.cpp b/deployment/ComponentLoader.cpp
index 7dc668a..6d5fa4e 100644
--- a/deployment/ComponentLoader.cpp
+++ b/deployment/ComponentLoader.cpp
@@ -183,6 +183,11 @@ bool ComponentLoader::import( std::string const& package, std::string const& pat
path dir = arg.parent_path();
string file = arg.filename();

+ // if path is absolute don't try to be smart
+ if (package[0] == '/' && is_regular_file(arg)) {
+ return loadInProcess(arg.string(), makeShortFilename(file), true);
+ }
+
for (vector<string>::iterator it = paths.begin(); it != paths.end(); ++it)
{
path p = path(*it) / dir / (file + SO_EXT);

[PATCH] deployment: make loadLibrary respect absolute paths

Peter,

Can you pick up this patch?

Thanks!
Markus

On Tue, Jul 20, 2010 at 05:08:56PM +0200, Markus Klotzbuecher wrote:
> ---
> deployment/ComponentLoader.cpp | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/deployment/ComponentLoader.cpp b/deployment/ComponentLoader.cpp
> index 7dc668a..6d5fa4e 100644
> --- a/deployment/ComponentLoader.cpp
> +++ b/deployment/ComponentLoader.cpp
> @@ -183,6 +183,11 @@ bool ComponentLoader::import( std::string const& package, std::string const& pat
> path dir = arg.parent_path();
> string file = arg.filename();
>
> + // if path is absolute don't try to be smart
> + if (package[0] == '/' && is_regular_file(arg)) {
> + return loadInProcess(arg.string(), makeShortFilename(file), true);
> + }
> +
> for (vector<string>::iterator it = paths.begin(); it != paths.end(); ++it)
> {
> path p = path(*it) / dir / (file + SO_EXT);

[PATCH] deployment: make loadLibrary respect absolute paths

On Tuesday 31 August 2010 09:18:20 Markus Klotzbuecher wrote:
> Peter,
>
> Can you pick up this patch?

This patch is not portable. I would just go for the check
(is_regular_file(arg)) like this:

diff --git a/deployment/ComponentLoader.cpp b/deployment/ComponentLoader.cpp
index 7dc668a..6d5fa4e 100644
--- a/deployment/ComponentLoader.cpp
+++ b/deployment/ComponentLoader.cpp
@@ -183,6 +183,11 @@ bool ComponentLoader::import( std::string const& package,
std::string const& pat
path dir = arg.parent_path();
string file = arg.filename();

+ // if path is absolute don't try to be smart
+ if ( is_regular_file(arg) ) {
+ return loadInProcess(arg.string(), makeShortFilename(file), true);
+ }
+
for (vector<string>::iterator it = paths.begin(); it != paths.end();
++it)
{
path p = path(*it) / dir / (file + SO_EXT);

[PATCH] deployment: make loadLibrary respect absolute paths

On 08/31/2010 10:15 AM, Peter Soetens wrote:
> On Tuesday 31 August 2010 09:18:20 Markus Klotzbuecher wrote:
>> Peter,
>>
>> Can you pick up this patch?
>
> This patch is not portable. I would just go for the check
> (is_regular_file(arg)) like this:

Is not that some logic that already exists in the plugin loader ???? I
am confused to see it again here.

[PATCH] deployment: make loadLibrary respect absolute paths

On Wednesday 01 September 2010 02:20:17 Sylvain Joyeux wrote:
> On 08/31/2010 10:15 AM, Peter Soetens wrote:
> > On Tuesday 31 August 2010 09:18:20 Markus Klotzbuecher wrote:
> >> Peter,
> >>
> >> Can you pick up this patch?
> >
> > This patch is not portable. I would just go for the check
> > (is_regular_file(arg)) like this:
>
> Is not that some logic that already exists in the plugin loader ???? I
> am confused to see it again here.

Yes. It's kind-of duplicate in PluginLoader and ComponentLoader. That's why I
didn't pick it up first, I thought I already applied it from your branch.

There's no need yet to refactor this. It works.

Peter

[PATCH] deployment: make loadLibrary respect absolute paths

On Tue, Aug 31, 2010 at 10:15:39AM +0200, Peter Soetens wrote:
> On Tuesday 31 August 2010 09:18:20 Markus Klotzbuecher wrote:
> > Peter,
> >
> > Can you pick up this patch?
>
> This patch is not portable. I would just go for the check
> (is_regular_file(arg)) like this:

Uh, I see...

> diff --git a/deployment/ComponentLoader.cpp b/deployment/ComponentLoader.cpp
> index 7dc668a..6d5fa4e 100644
> --- a/deployment/ComponentLoader.cpp
> +++ b/deployment/ComponentLoader.cpp
> @@ -183,6 +183,11 @@ bool ComponentLoader::import( std::string const& package,
> std::string const& pat
> path dir = arg.parent_path();
> string file = arg.filename();
>
> + // if path is absolute don't try to be smart
> + if ( is_regular_file(arg) ) {

Event better if that doesn't break anything. That should allow
relative paths to work too.

> + return loadInProcess(arg.string(), makeShortFilename(file), true);
> + }
> +
> for (vector<string>::iterator it = paths.begin(); it != paths.end();
> ++it)
> {
> path p = path(*it) / dir / (file + SO_EXT);

Best regards
Markus