Skip to content

Commit

Permalink
Unsatisfyingly handle mis-behaving mac hosts (#871)
Browse files Browse the repository at this point in the history
Some mac hosts use their bundle, not the VST bundle, as
the bundle reference for the VST. Notably users report
Live 9.7 appears to do this. There's nothing we can really
do except do a hack and hope you installed in the global
location before bailing. But we might as well try that.

Closes #870
  • Loading branch information
baconpaul authored May 9, 2019
1 parent 6d1df2b commit af8c831
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/common/gui/CScalableBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#if MAC
#include <CoreFoundation/CoreFoundation.h>
#include "vstgui/lib/platform/mac/macglobals.h"
#include <strstream>
#endif
#if LINUX
#include "ScalablePiggy.h"
Expand Down Expand Up @@ -51,6 +52,7 @@ static const std::string svgFullFileNameFromBundle(const std::string& filename)

return "";
}

#endif

#if LINUX
Expand Down Expand Up @@ -87,6 +89,7 @@ void CScalableBitmap::setPhysicalZoomFactor(int zoomFactor)
currentPhysicalZoomFactor = zoomFactor;
}


CScalableBitmap::CScalableBitmap(CResourceDescription desc, VSTGUI::CFrame* f)
: CBitmap(desc), svgImage(nullptr), frame(f)
{
Expand All @@ -102,6 +105,26 @@ CScalableBitmap::CScalableBitmap(CResourceDescription desc, VSTGUI::CFrame* f)
#if MAC
std::string fullFileName = svgFullFileNameFromBundle(filename.str());
svgImage = nsvgParseFromFile(fullFileName.c_str(), "px", 96);

/*
** Some older versions of live are reported to not set the bundle identity
** properly. There are all sorts of complicated ways to deal with this. Here
** though is one which isn't great but gives those users a bit of hope
*/
if (!svgImage)
{
std::ostringstream fn2;
#if TARGET_AUDIOUNIT
fn2 << "/Library/Audio/Plug-Ins/Components/Surge.component/Contents/Resources/" << filename.str();
#elif TARGET_VST2
fn2 << "/Library/Audio/Plug-Ins/VST/Surge.vst/Contents/Resources/" << filename.str();
#elif TARGET_VST3
fn2 << "/Library/Audio/Plug-Ins/VST3/Surge.vst3/Contents/Resources/" << filename.str();
#endif

std::cout << "FailBack from bad module SVG path to best guess: [" << fn2.str() << "]" << std::endl;
svgImage = nsvgParseFromFile(fn2.str().c_str(), "px", 96);
}
#endif

#if WINDOWS
Expand Down
2 changes: 0 additions & 2 deletions src/common/gui/SurgeBitmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void SurgeBitmaps::setupBitmapsForFrame(VSTGUI::CFrame* f)
addEntry(IDB_BUTTON_ABOUT, f);
addEntry(IDB_ABOUT, f);
addEntry(IDB_FILTERBUTTONS, f);
addEntry(IDB_OSCSWITCH, f);
addEntry(IDB_FILTERSUBTYPE, f);
addEntry(IDB_RELATIVE_TOGGLE, f);
addEntry(IDB_OSCSELECT, f);
Expand All @@ -47,7 +46,6 @@ void SurgeBitmaps::setupBitmapsForFrame(VSTGUI::CFrame* f)
addEntry(IDB_ENVSHAPE, f);
addEntry(IDB_FXBYPASS, f);
addEntry(IDB_LFOTRIGGER, f);
addEntry(IDB_BUTTON_CHECK, f);
addEntry(IDB_BUTTON_MINUSPLUS, f);
addEntry(IDB_UNIPOLAR, f);
addEntry(IDB_CHARACTER, f);
Expand Down

0 comments on commit af8c831

Please sign in to comment.