diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0275fc6..b439c25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,12 @@ jobs: run: brew install openssl - name: Install Dependencies run: zef install --/test --test-depends --deps-only . - - name: Install App::Prove6 - run: zef install --/test App::Prove6 - - name: Run Tests - run: raku -I. -e "require(q[Build.rakumod]); ::(q[Build]).new.build(q[.])" && prove6 -I. t + - name: Build + run: zef build . + - name: Stage, Test, and Installation + run: zef install . --debug + - name: Ensure dll rename hack works + if: runner.os == 'Windows' + run: | + Remove-Item -Path $env:TEMP\* -Recurse -Force -ErrorAction Ignore + raku ${{ github.workspace }}/t/06-digest-md5.t diff --git a/lib/OpenSSL/NativeLib.rakumod b/lib/OpenSSL/NativeLib.rakumod index aed40ad..1513435 100644 --- a/lib/OpenSSL/NativeLib.rakumod +++ b/lib/OpenSSL/NativeLib.rakumod @@ -30,16 +30,16 @@ sub crypto-lib is export { # XXX: This should be removed when CURI/%?RESOURCES gets a mechanism to bypass name mangling use nqp; sub dll-resource($resource-name) { - my $resource = %?RESOURCES{$resource-name}; - return $resource.absolute if $resource.basename eq $resource-name; - - my $content_id = nqp::sha1($resource.absolute); - my $content_store = $*TMPDIR.child($content_id); - my $content_file = $content_store.child($resource-name).absolute; - return $content_file if $content_file.IO.e; - - mkdir $content_store unless $content_store.e; - copy($resource, $content_file); - - $content_file; + my $content-id = nqp::sha1($resource-name); + my $dll-directory = $*TMPDIR.add($content-id); + my $dll-resource = $dll-directory.add($resource-name); + + unless $dll-resource.e { + mkdir $dll-directory unless $dll-directory.e; + my $resource = %?RESOURCES{$resource-name}; + my $resource-data := %?RESOURCES{$resource-name}.slurp(:bin, :close); + $dll-resource.spurt($resource-data, :bin, :close); + } + + return $dll-resource.absolute; }