File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,33 @@ has &!call_method;
8
8
use NativeCall ;
9
9
10
10
sub native (Sub $ sub ) {
11
- my $ so = ' pyhelper.so' ;
11
+ my $ so = $ * VM . config<dll >;
12
+ $ so ~~ s !^.* \% s !pyhelper! ;
13
+ my $ base = " lib/Inline/$ so" ;
12
14
state Str $ path ;
13
15
unless $ path {
14
16
for @ * INC {
15
- if " $ _ /Inline/$ so" . IO ~~ : f {
16
- $ path = " $ _ /Inline/$ so" ;
17
+ my $ cur = $ _ ~~ Str ?? CompUnitRepo. new ($ _ ) !! $ _ ;
18
+ if my @ files = ($ cur . files($ base ) || $ cur . files(" blib/$ base" )) {
19
+ my $ files = @ files [0 ]<files >;
20
+ my $ tmp = $ files {$ base } || $ files {" blib/$ base" };
21
+
22
+ # copy to a temp dir
23
+ #
24
+ # This is required because CompUnitRepo::Local::Installation stores the file
25
+ # with a different filename (a number with no extension) that NativeCall doesn't
26
+ # know how to load. We do this copy to fix the filename.
27
+ $ path = $ * SPEC . tmpdir ~ ' /' ~ $ * PID ~ ' -' ~ $ so ;
28
+
29
+ $ tmp . IO . copy ($ path );
30
+ }
31
+ }
32
+ }
33
+ unless $ path { # TEMPORARY !!!!
34
+ for @ * INC . grep (Str ) {
35
+ my $ file = " $ _. substr (5 ) /Inline/$ so" ;
36
+ if $ file . IO . e {
37
+ $ path = $ file ;
17
38
last ;
18
39
}
19
40
}
You can’t perform that action at this time.
0 commit comments