Skip to content

Commit

Permalink
Fix issues with loading the WebP library.
Browse files Browse the repository at this point in the history
It seems that the libwebp.so symlink is only available if libwebp-dev is
installed. I've added a DllMap (http://www.mono-
project.com/docs/advanced/pinvoke/#library-handling) to load
libwebp.so.5 as a fallback.
  • Loading branch information
cameronwhite committed Feb 23, 2015
1 parent a89323a commit bccde23
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion WebPAddin/.addin.xml
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Addin id="WebP" version="0.2" category="File Formats">
<Addin id="WebP" version="0.2.1" category="File Formats">
<!-- This is the information shown in the add-in manager, with translations -->
<Header>
<Name>WebP</Name>
<Description>Provides support for the WebP image format.</Description>
<Author>Pinta Project</Author>
<Url>https://github.com/PintaProject/WebPAddin</Url>
</Header>
<Runtime>
<Import file="WebPAddin.dll.config"/>
</Runtime>
<Dependencies>
<Addin id="Pinta" version="1.5" />
</Dependencies>
Expand Down
2 changes: 1 addition & 1 deletion WebPAddin/NativeMethods.cs
Expand Up @@ -53,7 +53,7 @@ public class NativeMethods
public static void ShowErrorDialog (Gtk.Window parent)
{
var dialog = new Gtk.MessageDialog (parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
AddinManager.CurrentLocalizer.GetString ("Could not load WebP library."));
AddinManager.CurrentLocalizer.GetString ("Could not find an installed WebP library."));
dialog.Title = AddinManager.CurrentLocalizer.GetString ("Error");
dialog.Run ();
dialog.Destroy ();
Expand Down
12 changes: 11 additions & 1 deletion WebPAddin/WebPAddin.csproj
Expand Up @@ -29,24 +29,29 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<Package>glib-sharp-2.0</Package>
</Reference>
<Reference Include="System" />
<Reference Include="Mono.Addins, Version=0.6.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
<HintPath>lib\Mono.Addins.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Private>False</Private>
<Package>gtk-sharp-2.0</Package>
</Reference>
<Reference Include="Mono.Cairo" />
<Reference Include="Pinta.Core">
<HintPath>lib\Pinta.Core.dll</HintPath>
</Reference>
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Private>False</Private>
<Package>gtk-sharp-2.0</Package>
</Reference>
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Private>False</Private>
<Package>gtk-sharp-2.0</Package>
</Reference>
</ItemGroup>
<ItemGroup>
Expand All @@ -61,4 +66,9 @@
<ItemGroup>
<EmbeddedResource Include=".addin.xml" />
</ItemGroup>
<ItemGroup>
<None Include="WebPAddin.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions WebPAddin/WebPAddin.dll.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<dllmap dll="webp" target="libwebp.so.5"/>
</configuration>

0 comments on commit bccde23

Please sign in to comment.