Skip to content

Commit

Permalink
Move Windows Assets to ProgramData
Browse files Browse the repository at this point in the history
Move windows assets to ProgramData, failing back to LocalAppData.
Show paths in the About screen. Modify the installers.

Addresses surge-synthesizer#1289
  • Loading branch information
baconpaul committed Jan 25, 2020
1 parent 5aae014 commit be611b6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion installer_win/surge-x86.iss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Name: EffectsVST3; Description: SurgeEffectsBank VST3 Plug-in (32 bit); Types: f
Source: ..\target\vst2\Release\Surge_x86.dll; DestDir: {app}; Components: VST2; Flags: ignoreversion skipifsourcedoesntexist
Source: ..\target\vst3\Release\Surge_x86.vst3; DestDir: {cf}\VST3; Components: VST3; Flags: ignoreversion
Source: ..\fxbuild\surge-fx\Builds\VisualStudio2017\Win32\ReleaseWin32\VST3\SurgeEffectsBank.vst3; DestDir: {cf}\VST3; Components: EffectsVST3; Flags: ignoreversion skipifsourcedoesntexist
Source: ..\resources\data\*; DestDir: {localappdata}\Surge; Components: Data; Flags: recursesubdirs; Excludes: "*.git";
Source: ..\resources\data\*; DestDir: {commonappdata}\Surge; Components: Data; Flags: recursesubdirs; Excludes: "*.git";
Source: ..\resources\fonts\Lato-Regular.ttf; DestDir: "{fonts}"; Components: Data; FontInstall: "Lato"; Flags: onlyifdoesntexist uninsneveruninstall

[Languages]
Expand Down
2 changes: 1 addition & 1 deletion installer_win/surge.iss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Name: EffectsVST3; Description: SurgeEffectsBank VST3 Plug-in (64 bit); Types: f
Source: ..\target\vst2\Release\Surge.dll; DestDir: {app}; Components: VST2; Flags: ignoreversion skipifsourcedoesntexist
Source: ..\target\vst3\Release\Surge.vst3; DestDir: {cf}\VST3; Components: VST3; Flags: ignoreversion
Source: ..\fxbuild\surge-fx\Builds\VisualStudio2017\x64\Release\VST3\SurgeEffectsBank.vst3; DestDir: {cf}\VST3; Components: EffectsVST3; Flags: ignoreversion skipifsourcedoesntexist
Source: ..\resources\data\*; DestDir: {localappdata}\Surge; Components: Data; Flags: recursesubdirs; Excludes: "*.git";
Source: ..\resources\data\*; DestDir: {commonappdata}\Surge; Components: Data; Flags: recursesubdirs; Excludes: "*.git";
Source: ..\resources\fonts\Lato-Regular.ttf; DestDir: "{fonts}"; Components: Data; FontInstall: "Lato"; Flags: onlyifdoesntexist uninsneveruninstall

[Languages]
Expand Down
22 changes: 19 additions & 3 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,28 @@ SurgeStorage::SurgeStorage(std::string suppliedDataPath)
#if TARGET_RACK
datapath = suppliedDataPath;
#else
PWSTR localAppData;
if (!SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &localAppData))
bool foundSurge = false;
PWSTR commonAppData;
if (!SHGetKnownFolderPath(FOLDERID_ProgramData, 0, nullptr, &commonAppData))
{
CHAR path[4096];
wsprintf(path, "%S\\Surge\\", localAppData);
wsprintf(path, "%S\\Surge\\", commonAppData);
datapath = path;
if( fs::is_directory( fs::path( datapath ) ) )
foundSurge = true;
else
datapath = "";
}

if( ! foundSurge ) {
PWSTR localAppData;
if (!SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &localAppData))
{
CHAR path[4096];
wsprintf(path, "%S\\Surge\\", localAppData);
datapath = path;
foundSurge = true;
}
}

PWSTR documentsFolder;
Expand Down
7 changes: 5 additions & 2 deletions src/common/gui/CAboutBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ void CAboutBox::draw(CDrawContext* pContext)
std::vector< std::string > msgs = { {
std::string() + "Version " + SURGE_STR(SURGE_VERSION) + " (" + bittiness + " " + platform + " " + flavor + ". Built " +
__DATE__ + " " + __TIME__ + ")",
std::string() + "Resources: dataPath=" + dataPath + " userData=" + userPath,
"Released under the GNU General Public License, v3",
"Copyright 2005-2019 by individual contributors",
"Copyright 2005-2020 by individual contributors",
"Source, contributors and other information at https://github.com/surge-synthesizer/surge",
"VST Plug-in technology by Steinberg, AU Plugin Technology by Apple Computer"
} };
Expand Down Expand Up @@ -103,8 +104,10 @@ bool CAboutBox::hitTest(const CPoint& where, const CButtonState& buttons)

//------------------------------------------------------------------------

void CAboutBox::boxShow()
void CAboutBox::boxShow(std::string dataPath, std::string userPath)
{
this->dataPath = dataPath;
this->userPath = userPath;
setViewSize(toDisplay);
setMouseableArea(toDisplay);
value = 1.f;
Expand Down
3 changes: 2 additions & 1 deletion src/common/gui/CAboutBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CAboutBox : public VSTGUI::CControl
const VSTGUI::CButtonState& buttons); ///< called when a mouse down event occurs
virtual void unSplash();

void boxShow();
void boxShow(std::string dataPath, std::string userPath);
void boxHide(bool invalidateframe = true);

CLASS_METHODS(CAboutBox, VSTGUI::CControl)
Expand All @@ -41,6 +41,7 @@ class CAboutBox : public VSTGUI::CControl
VSTGUI::CPoint offset;
VSTGUI::SharedPointer<VSTGUI::CBitmap> _aboutBitmap;
bool bvalue;
std::string dataPath, userPath;

static VSTGUI::SharedPointer<VSTGUI::CFontDesc> infoFont;
};
2 changes: 1 addition & 1 deletion src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3439,7 +3439,7 @@ void SurgeGUIEditor::showSettingsMenu(CRect &menuRect)

addCallbackMenu(settingsMenu, "About", [this]() {
if (aboutbox)
((CAboutBox*)aboutbox)->boxShow();
((CAboutBox*)aboutbox)->boxShow(this->synth->storage.datapath, this->synth->storage.userDataPath);
});
eid++;

Expand Down

0 comments on commit be611b6

Please sign in to comment.