Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Figure out path to shared lib

  • Loading branch information...
commit e167e737f998d0269b380b16c2fdd2cbc9e28ba5 1 parent 83471f5
@msantos authored
Showing with 14 additions and 11 deletions.
  1. +1 −1  c_src/crypt.c
  2. +13 −10 src/crypt.erl
View
2  c_src/crypt.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
+/* Copyright (c) 2010-2012, Michael Santos <michael.santos@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
View
23 src/crypt.erl
@@ -1,4 +1,4 @@
-%% Copyright (c) 2010, Michael Santos <michael.santos@gmail.com>
+%% Copyright (c) 2010-2012, Michael Santos <michael.santos@gmail.com>
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
@@ -36,15 +36,18 @@
on_load() ->
- Lib = filename:join([
- filename:dirname(code:which(?MODULE)),
- "..",
- "priv",
- ?MODULE
- ]),
- erlang:load_nif(Lib, 0).
+ Lib = case code:priv_dir(?MODULE) of
+ {error,bad_name} ->
+ filename:join([
+ filename:dirname(code:which(?MODULE)),
+ "..",
+ "priv",
+ ?MODULE
+ ]);
+ Dir ->
+ filename:join([Dir, ?MODULE])
+ end,
+ erlang:load_nif(Lib, []).
crypt(_,_) ->
erlang:error(not_implemented).
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.