Skip to content

Commit

Permalink
Remove Win32 SHGetKnownFolderPath; fix windows builds
Browse files Browse the repository at this point in the history
Due to an upstream bug, mingw has issues building with shlobj.h.  This work-around fixes LMMS#1952 by falling back to a `getenv()` approach.
  • Loading branch information
tresf committed Apr 21, 2015
1 parent 13f7065 commit b19a9dc
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,31 +252,6 @@ void ConfigManager::setValue( const QString & _class,



#ifdef LMMS_BUILD_WIN32
#include <QLibrary>
#include <shlobj.h>

// taken from qt-win-opensource-src-4.2.2/src/corelib/io/qsettings.cpp
static QString windowsConfigPath( int _type )
{
QString result;

QLibrary library( "shell32" );
typedef BOOL( WINAPI* GetSpecialFolderPath )( HWND, char *, int, BOOL );
GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)
library.resolve( "SHGetSpecialFolderPathA" );
if( SHGetSpecialFolderPath )
{
char path[MAX_PATH];
SHGetSpecialFolderPath( 0, path, _type, false );
result = QString::fromLocal8Bit( path );
}
return result;
}
#endif



void ConfigManager::loadConfigFile()
{
// read the XML file and create DOM tree
Expand Down Expand Up @@ -381,8 +356,8 @@ void ConfigManager::loadConfigFile()
!QDir( m_vstDir ).exists() )
{
#ifdef LMMS_BUILD_WIN32
m_vstDir = windowsConfigPath( CSIDL_PROGRAM_FILES ) +
QDir::separator() + "VstPlugins";
QString programFiles = getenv("ProgramFiles");
m_vstDir = programFiles + QDir::separator() + "VstPlugins";
#else
m_vstDir = m_workingDir + "plugins/vst" + QDir::separator();
#endif
Expand Down

1 comment on commit b19a9dc

@tresf
Copy link
Owner Author

@tresf tresf commented on b19a9dc Apr 27, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test results (wine):

image

Please sign in to comment.