Permalink
Browse files

Be smarter about finding the lib path

  • Loading branch information...
1 parent 12118be commit 82cfc33bad638b1a2100302c0fc0990214020bf0 @msantos committed Aug 16, 2012
Showing with 16 additions and 6 deletions.
  1. +1 −1 priv/example.xml.dist
  2. +15 −5 src/vert.erl
View
@@ -1,6 +1,6 @@
<domain type='qemu'>
<name>testvm</name>
- <uuid>98da79eb-5b19-7be8-ca76-a1acff00e4d3</uuid>
+ <uuid>98da79eb-5b19-7be8-cb76-a1acff00e4d3</uuid>
<memory>219136</memory>
<currentMemory>219136</currentMemory>
<vcpu>1</vcpu>
View
@@ -854,13 +854,23 @@ bool(Error) -> Error.
ok({ok, _}) -> ok;
ok(Error) -> Error.
-privdir(File) ->
+progname_ebin() ->
filename:join([
filename:dirname(code:which(?MODULE)),
- "..",
- "priv",
- File
+ "..", "priv", ?MODULE
]).
+progname_priv() ->
+ case application:get_env(?MODULE, port_executable) of
+ {ok, Executable} -> Executable;
+ undefined -> filename:join([
+ code:priv_dir(?MODULE),
+ ?MODULE
+ ])
+ end.
+
niflib() ->
- privdir(?MODULE).
+ case code:priv_dir(?MODULE) of
+ {error, bad_name} -> progname_ebin();
+ _ -> progname_priv()
+ end.

0 comments on commit 82cfc33

Please sign in to comment.