Skip to content

Commit

Permalink
Merge pull request #177 from mdaus/better_path_for_binary_release
Browse files Browse the repository at this point in the history
Better path for binary release
  • Loading branch information
JonathanMeans authored Mar 12, 2020
2 parents 83f8e88 + e28ad0e commit d2bf2fc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,16 @@ of fixing it later, which will make me eternally grateful.

NITF Library Users: General Issues
----------------------------------
If you want to use the default TRE plugins that come with the library,
NITRO already knows where they are installed, and you don't have to
do anything.

If you want to override this behavior, you can set the
`NITF_PLUGIN_PATH` environment variable to your preferred location.
NITRO handles TREs by loading dynamic libraries at runtime. Therefore, you need
to make sure NITRO can find them.

* If you are building from source, the location will be compiled in, and
you don't have to do anything extra.

* If you are working from a binary release, you will have to tell
NITRO where the plugins are by setting the `NITF_PLUGIN_PATH`
enviornment variable.
This should look something like `<install>/share/nitf/plugins`.

* If you wish to use a custom TRE location, you can also specify that
with `NITF_PLUGIN_PATH`.
18 changes: 15 additions & 3 deletions modules/c/nitf/source/PluginRegistry.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,24 @@ NITFPRIV(nitf_PluginRegistry*) implicitConstruct(nitf_Error* error)
if (!pluginEnvVar)
{
/* Take the default path */
strcpy(reg->path, NITF_DEFAULT_PLUGIN_PATH);
return reg;
if (nrt_Directory_exists(NITF_DEFAULT_PLUGIN_PATH))
{
strncpy(reg->path, NITF_DEFAULT_PLUGIN_PATH, NITF_MAX_PATH);
return reg;
}
else
{
fprintf(stderr,
"Warning: Unable to find plugin path.\n"
"Specify plugin location by setting environment variable "
"%s, or by building the library from source\n",
NITF_PLUGIN_PATH);
return reg;
}
}
else
{
strcpy(reg->path, pluginEnvVar);
strncpy(reg->path, pluginEnvVar, NITF_MAX_PATH);
}
/*
* If the we have a user-defined path, they might not
Expand Down

0 comments on commit d2bf2fc

Please sign in to comment.