Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Linux File Access #3769

Merged
merged 11 commits into from
Feb 18, 2025
14 changes: 8 additions & 6 deletions src/Plugins/LevelDBStore/LevelDBStore.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk" InitialTargets="DownloadNativeLibs">

<PropertyGroup>
<TargetFrameworks>net9.0</TargetFrameworks>
<BuildInParallel>false</BuildInParallel>
<PackageId>Neo.Plugins.Storage.LevelDBStore</PackageId>
<RootNamespace>Neo.Plugins.Storage</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<OutputPath>../../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<Target Name="DownloadNativeLibs" BeforeTargets="PreBuildEvent">
<DownloadFile Condition="!Exists('runtimes/%(NativeLib.RuntimeId)/native/%(NativeLib.Lib)')" SourceUrl="https://github.com/neo-ngd/leveldb/releases/download/v1.23/libleveldb-%(NativeLib.RuntimeId).zip" DestinationFolder="$(BaseIntermediateOutputPath)" Retries="3" />
<Unzip Condition="Exists('$(BaseIntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId).zip') And !Exists('runtimes/%(NativeLib.RuntimeId)/native/%(NativeLib.Lib)')" SourceFiles="$(BaseIntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId).zip" DestinationFolder="$(BaseIntermediateOutputPath)" OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" />
<Move SourceFiles="$(BaseIntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/%(NativeLib.Lib)" DestinationFolder="$(BaseIntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/runtimes/%(NativeLib.RuntimeId)/native/" OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" />
<Target Name="DownloadNativeLibs">
<DownloadFile Condition="!Exists('$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/runtimes/%(NativeLib.RuntimeId)/native/%(NativeLib.Lib)')" SourceUrl="https://github.com/neo-ngd/leveldb/releases/download/v1.23/libleveldb-%(NativeLib.RuntimeId).zip" DestinationFolder="$(IntermediateOutputPath)" Retries="3" />
<Unzip Condition="Exists('$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId).zip') And !Exists('$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/runtimes/%(NativeLib.RuntimeId)/native/%(NativeLib.Lib)')" SourceFiles="$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId).zip" DestinationFolder="$(IntermediateOutputPath)" OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" />
<Move Condition="Exists('$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/%(NativeLib.Lib)') And !Exists('$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/runtimes/%(NativeLib.RuntimeId)/native/%(NativeLib.Lib)')" SourceFiles="$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/%(NativeLib.Lib)" DestinationFolder="$(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/runtimes/%(NativeLib.RuntimeId)/native/" OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" />
<Message Importance="high" Text="Location is $(IntermediateOutputPath)libleveldb-%(NativeLib.RuntimeId)/runtimes/%(NativeLib.RuntimeId)/native/%(NativeLib.Lib)" />
</Target>

<ItemGroup>
Expand All @@ -23,7 +25,7 @@
<NativeLib Include="%(RuntimeId)-%(Lib)" RuntimeId="osx-x64" Lib="libleveldb.dylib" />
<NativeLib Include="%(RuntimeId)-%(Lib)" RuntimeId="osx-arm64" Lib="libleveldb.dylib" />

<Content Include="@(NativeLib -> '$(BaseIntermediateOutputPath)libleveldb-%(RuntimeId)/runtimes/%(RuntimeId)/native/%(Lib)')" PackagePath="runtimes/%(RuntimeId)/native/%(Lib)" Link="runtimes/%(RuntimeId)/native/%(Lib)">
<Content Include="@(NativeLib -> '$(IntermediateOutputPath)libleveldb-%(RuntimeId)/runtimes/%(RuntimeId)/native/%(Lib)')" PackagePath="runtimes/%(RuntimeId)/native/%(Lib)" Link="runtimes/%(RuntimeId)/native/%(Lib)">
<Pack>true</Pack>
<Visible>false</Visible>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down