This started in the Outdated Apps thread, and (rightfully) got deleted from there, as it should have been split off to another thread if it was to continue.
Summary of the discussion so far:
- Bart.S: MuseScore
-
MuseScore 2.0.3 has been released.
It eats some settings on upgrade though.
I'll investigate.John, maybe you could create a new splash in the meantime:
https://github.com/musescore/MuseScore/blob/2.0.3/mscore/data/splash.png
- John T. Haller: Splash
-
https://portableapps.com/downloads/MuseScorePortable.jpg
- Bart.S: Thanks
-
Thanks for the splash.
I have reported a bug: https://musescore.org/en/node/104936
Maybe they'll fix it soon or I have to create some custom installer code to keep portable paths.
- 3D1T0R: Try this
-
This copies the contents of
Data\Settings\MuseScore2.ini
's[General]:sfPath
to[General]:mySoundfontsPath
(if[General]:sfPath
is present). Is this enough? or do we need to edit the value at all? and/or do we need to remove[General]:sfPath
too?!macro CustomCodePreInstall ${If} ${FileExists} "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" ReadINIStr $0 "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "sfPath" StrCmp $0 "" +2 WriteINIStr "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "mySoundfontsPath" '"$0"' ${EndIf} !macroend
- Bart.S: (Sorry, I forget what exactly this post said, and I the page where I'd looked at it wasn't still open when I went to write this)
- Something was said about copying the value may not be enough, and that Bart.S had implemented some "magic", but nothing more specific about it was stated.
Well, here's my reply:
You didn't say what "magic" you'd implemented, and since I'd already started, I kept working on it.
So, after analyzing their source, and a bunch of experimentation, I don't think that just copying it would be a problem, but you're right, we should probably emulate the changes they do in their upgrade code if we can, and I've written a new Other\Source\PortableApps.comInstallerCustom.nsh
which does everything their code does, and saves it in the new location.
Also, I think the sfPath
shouldn't be removed until the installation is complete (to be safe), so I put that bit in CustomCodePostInstall
, and had it check to make sure both sfPath
and mySoundfontsPath
were present before it would delete it:
!macro CustomCodePreInstall ${If} ${FileExists} "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" ReadINIStr $0 "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "sfPath" IfErrors sfPathNotFound ${WordFind} $0 ";" "#" $1 ; How many folders are there? PushSoundFontFolderToStack: ${WordFind} $0 ";" +$1 $2 ; This is one folder. Push $2 ; Push it to the stack. IntOp $1 $1 - 1 ; One less to do. StrCmp $1 0 0 PushSoundFontFolderToStack ; If there are any left to do, go back and do the next one. ${WordReplace} "$INSTDIR\App\MuseScore\sound" '\' "/" "+" $3 ; Convert \ to / ${WordFind} $0 ";" "#" $1 ; We need to know how many folders are there again. StrCpy $0 "" ; Clear $0 in preparation to rebuild it. PopSoundFontFolderFromStack: Pop $2 ; Put one of the folders in $2 StrCmp $2 $3 +2 ; If $2 is "%PAL:AppDir%\MuseScore\sound", skip next line. StrCpy $0 "$0$2;" ; Add it (and a ;) to $0 IntOp $1 $1 - 1 ; One less to do. StrCmp $1 0 0 PopSoundFontFolderFromStack ; If there are any left to do, go back and do the next one. StrCpy $0 $0 -1 ; Remove extra ; at end ${WordFind} $0 ";" "#" $1 ; Now: How many folders are still there? IntCmp $1 1 +2 +2 ; If there's only one, skip the next line. StrCpy $0 `"$0"` ; Add quotes around $0 WriteINIStr "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "mySoundfontsPath" $0 sfPathNotFound: ${EndIf} !macroend !macro CustomCodePostInstall ${If} ${FileExists} "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" ClearErrors ReadINIStr $0 "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "sfPath" ReadINIStr $0 "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "mySoundfontsPath" IfErrors +2 ; If sfPath or mySoundfontsPath not found, skip next line. DeleteINIStr "$INSTDIR\Data\settings\MuseScore\MuseScore2.ini" "General" "sfPath" ${EndIf} !macroend
P.S.: I also commented the code pretty heavily to make sure it would be (relatively) easy to follow.
I said thanks for the support and didn't add the code because everyone can see it when MuseScore Portable 2.0.3 is released.
For the impatient:
I forgot to add the quotes around $8 and MuseScore reads first path only without quotes.
John, if it's not to late replace line 27 by
Will do!
Sometimes, the impossible can become possible, if you're awesome!
MuseScore only adds quotes to it if there's more than one folder.
Shouldn't we do the same?
~3D1T0R
do the quotes hurt if one folder only? I can't test at the moment.
I don't know.
I kind of doubt it, but I didn't think that leaving App\MuseScore\sound should hurt either.
I just thought you were trying to exactly duplicate what MuseScore 2.0.3's built in upgrade code would have done (if it were working correctly).
~3D1T0R
I'm not sure, but there is a reason for removing MuseScore\sound and using a new ini setting.
I guess the MuseScore developers could tell.
I'm not trying to duplicate MuseScore's built in upgrade code. In fact, I haven't looked at it.
MuseScore doesn't mind the quotes if one folder only. It saves the folder without quotes after first run to ini.