You are here

[Outdated] PortableApps.com Launcher 1.0 Alpha 4

215 posts / 0 new
Last post
Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
[Outdated] PortableApps.com Launcher 1.0 Alpha 4

This is an outdated version of the PortableApps.com Launcher. The next release is available here.

Here is a development release of the official PortableApps.com Launcher (a continuation of my earlier project). For those interested, development is taking place in our Mercurial repositories.

The PortableApps.com Launcher is your PAL in making applications portable. It's a universal launcher for which you don't need to write code. Instead, it's configured with an INI file (which goes in App\AppInfo\launcher.ini), and uses a splash screen in App\AppInfo\splash.jpg.

Download the PortableApps.com Launcher 1.0 Alpha 4 [490KB download / 487KB installed]
(MD5: 7af01c521ee0a698b98516c3812d4d9f)

John hasn't yet put his registry handling improvements in (and any other improvements he has). DV, after that (and along with more work of mine) it will become 1.0 Beta and then after that 1.0.

Using the PortableApps.com Launcher:

This release is backwards-compatible with PortableApps.com Launcher 1.0 Pre-Alpha 1 except for the minor point of user overrides (AppNamePortable.ini instead of PortableApps.comLauncher.ini), but backwards-incompatible with Chris's PortableApps.com Launcher Test 5, however upgrading is fairly straightforward. Please read the release notes for information on how to upgrade your files.

Install it somewhere, and then copy PortableApps.comLauncher.exe into the directory of the portable application that you are developing; change the filename to match the AppID specified in appinfo.ini, e.g. AppNamePortable.exe. Configure it with a file called launcher.ini file in your portable app's App\AppInfo directory, and also copy the splash screen to App\AppInfo\splash.jpg. You can look at the included PortableApps.comLauncher.ini file to see what functionality is available, or read help.html which has pretty complete documentation of what everything does, including a couple of examples.

Release Notes:

  • 1.0 Alpha 4 (2010-02-17): improvements, bug-fixes and some changes in launcher.ini format (see comments or help.html).
  • 1.0 Alpha 3 (2010-02-15): various improvements and bug-fixes, see comments below and hg changelogs for details.
  • 1.0 Alpha 2 (2010-02-05):
    • Various bug-fixes (thanks in particular to computerfreaker who unearthed a few of them).
    • New feature: [Launch]:WaitForEXE=filename.exe to wait for an additional executable to close before cleaning up
    • New feature: [Launch]:RunAsAdmin=force|try|none. I would like testing on this - something like RapidSVN will do as a real case if you want it (uses HKLM).
    • New feature: [ServiceN]: services (and drivers). The implementation is not complete yet but should be functional (testing would be nice; for your own safety, it'd be a good idea to do it in a virtual machine you can revert).
    • Rename PortableApps.comLauncher.exe to AppNamePortable.exe again.
    • User overrides go in AppNamePortable.ini again.
  • 1.0 Pre-Alpha 1 (2010-01-29):
    • I achieved my goal with this release: it is completely backwards-incompatible with Chris's PortableApps.com Launcher Test 5 :D.
    • Changes:
      • RegistryKeyWrite --> RegistryValueWrite
      • [CommonFiles]:Java --> [Activate]:Java
      • App\ChrisLauncher\AppNamePortable.ini --> App\AppInfo\launcher.ini
      • App\ChrisLauncher\AppNamePortable.jpg --> App\AppInfo\splash.jpg
      • [AppDetails]:ProgramDirectory and [AppDetails]:ProgramExecutable have been merged (join with \) --> [LaunchDetails]:ProgramExecutable
    • Added:
      • [CommonFiles]:Registry
      • [RegistryValueBackupDelete]
      • [LaunchDetails]:RefreshShellIcons
      • java.util.prefs-style paths
      • Running the application from UNC paths will now cause an error.
      • Translations: the translations which were only used in Firefox and possibly a few others are available for all launchers now. Translations are welcome.
    • Removed:
      • [LiveMode]:CopyData (now forced true)
      • [AppDetails]:PortableAppLongName - made obsolete by appinfo
      • [AppDetails]: section has been made empty
    • Moved:
      • [LaunchDetails]: changed to [Launch].
      • [AppDetails]:AppLongName --> [LaunchDetails]:AppName
      • {AppName}Portable.ini user overrides must now be called PortableApps.comLauncher.ini and the header inside the file is [PortableApps.comLauncher]
    • Recommended:
      • [AppDetails]:AppLongName - leave blank unless [Details]:Name in appinfo.ini doesn't end in " Portable" or ", Portable Edition"
    • New translation strings:
      • Translations are needed for the following strings in all languages except French, German, Italian, Japanese, SimpChinese:

        ${LangFileString} LauncherFileNotFound "$PORTABLEAPPNAME cannot be started. You may wish to re-install to fix this issue. (ERROR: $MISSINGFILEORPATH could not be found)"
        ${LangFileString} LauncherAlreadyRunning "Another instance of $APPNAME is already running. Please close other instances of $APPNAME before launching $PORTABLEAPPNAME."
        ${LangFileString} LauncherAskCopyLocal "$PORTABLEAPPNAME appears to be running from a location that is read-only. Would you like to temporarily copy it to the local hard drive and run it from there?$\n$\nPrivacy Note: If you say Yes, your personal data within $PORTABLEAPPNAME will be temporarily copied to a local drive. Although this copy of your data will be deleted when you close $PORTABLEAPPNAME, it may be possible for someone else to access your data later."
        ${LangFileString} LauncherNoReadOnly "$PORTABLEAPPNAME can not run directly from a read-only location and will now close."
        ${LangFileString} LauncherPathTooLong "The path to $PORTABLEAPPNAME is too long.  Please shorten the path by eliminating some parent directories or shortening directory names."
        
      • Translations are needed for the following strings in all languages:
        ${LangFileString} LauncherNoUNCSupport "$PORTABLEAPPNAME cannot be started from a UNC path. Please map the directory to a drive letter and try again."
        ${LangFileString} LauncherNoSpaces "$PORTABLEAPPNAME cannot run from a directory with a space in it.  Please alter the current path ($EXEDIR) to remove any spaces and start the portable app again.  Please see the help.html file for more information."
        
  • Release notes from "Chris's PortableApps.com Launcher Test" releases are available here

Still to do:

  • Better language handling
  • Examine all the launchers I can get my hands on and implement anything I can think of
  • Suggestions very welcome - please suggest things!
agdurrette
Offline
Last seen: 1 year 1 day ago
Developer
Joined: 2008-01-16 13:55
I have two questions. Sorry

I have two questions.
Sorry if they are noobish questions.

First. Will this be a supported Portable App format.
Second (depends on the first). Will it become the Portable App format, or will we have a choice of the format we want?

"It's just an online installer. It's not going to mug you.", JTH
"The shell is the key to unlock Linux's greatest advantages."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
In the PortableApps.com Format Specification

The PortableApps.com Format Specification will be including this when it's finished. Unless there's a good reason why apps shouldn't use this (complexity beyond the scope of this), all official applications will be using this and applications in development should too.

I don't anticipate any more backwards-compatible changes in the format of launcher.ini. It's probably a good time for people to start thinking of migrating their applications to the PortableApps.com Launcher (or at least developing new applications with it).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

solanus
solanus's picture
Offline
Last seen: 10 years 1 month ago
Joined: 2006-01-21 19:12
In conjunction with the PortableApps Installer

Is this designed to gracefully upgrade apps?
What I mean is, how will it allow devs to release upgraded apps that will preserve the settings from the previously installed versions?

Like when you upgrade Firefox and it keeps your personal links and settings?

(I understand that it won't work upgrading an app that was previously created with CPAL)

I made this half-pony, half-monkey monster to please you.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Data is kept

I should have made myself clearer. Backwards incompatibility with CPAL is only with the development; once the developer has made a few changes to where the files are, and any sections or values which have changed names, it'll work again as before. It is our intention with the migration to using the PortableApps.com Launcher for all our applications that none lose any functionality. In a few cases we might need to add custom installer code, but normally the Launcher will be able to be configured to continue using the settings from the old application-specific launcher.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Just a quick question

Would it be okay to rename the launcher to AppNamePortable.exe? I'm fine with the INI being named PortableApps.comLauncher.ini (that actually makes a lot more sense), but having a bunch of PortableApps.comLauncher.exe in Task Manager would be confusing (what if God forbid I need to kill one? "Okay, now which one is it..."), plus it'd be better for people who don't use the Platform and instead launch manually if the launcher has a meaningful name.

solanus
solanus's picture
Offline
Last seen: 10 years 1 month ago
Joined: 2006-01-21 19:12
It seems to work

It seems to work OK if you rename it - I'm trying it out with my HuginPortable, and it opens OK, and handles the registry keys OK.

I made this half-pony, half-monkey monster to please you.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Must think about it

Currently it will work, but I can't guarantee it will continue to. Naming it PortableApps.comLauncher.exe is if anything more meaningful, I think, for users who use applications directly, as it mentions "Launcher". They'll know what the application is already. However, your comment about task management is something I (and I imagine John) hadn't thought about. Give us time to think about it and discuss it. In the meantime, use a decent task manager (e.g. DTaskManager or better still Process Explorer... or switch to Ubuntu like me and you'll get to use GNOME System Monitor ;-))!

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

Using a decent task manager won't help when all the launchers are named PortableApps.comLauncher. Let's say I have Firefox, Thunderbird, SpeedCrunch and uTorrent all open at once. Now which PA.c Launcher belongs to which app? I know the need to kill launchers should be rare, but it's not a complete non-issue either.

And besides, why should I install a "better" task manager when the built-in Windows one has served me fine thus far? The only time I ever open it is either to monitor what's still running (e.g. if Windows won't release my drive and I have to wait for everything to clear) or if I need to kill a process, and I can do both of those easily with the built-in app. No reason to use an SUV when a car is sufficient, know what I mean?

Jimbo
Offline
Last seen: 4 years 10 months ago
Joined: 2007-12-17 05:43
Tree view

Better process managers allow you to view the running processes in a hierarchical tree, and I'm guessing that Chris is assuming that you could work out which launcher was which by looking at the name of the child processes of each, and work out which one to kill that way.

Personally, I very much hope that it remains possible to make the launcher names match up with the apps they launch. Anyone not using the official PAP menu to launch these apps already has to suffer from the fact that the icons are becoming generic, without the further nightmare that the names might do the same.

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Yeah, it looks like Chris is

Yeah, it looks like Chris is saying "Use Process Explorer" because it can show tasks in a treeview.
But I seriously wonder how many "newbie" users will even know what Process Explorer is - most use the Windows Task Manager, and some (like me) probably keep PE for special tasks and use Task Manager for everyday life.

Generic icons, IMHO, doesn't pose a problem as long as you leave the installer names intact. I have a folder full of PA installers, something like 80 of them, and I can still find the installer I want within 10 seconds. Generic process names, on the other hand, will definitely pose a problem sooner or later IMHO.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Full path

I meant because they can tell you the full process path (and indeed the command line used to execute it, which can be very useful in making things portable).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Run as admin

The ability to run as administrator (force or try) is now in. If you want to try it out before I do another release (please do, I can't test it properly in Wine), you can get it from here.

Services and drivers are well on the way.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

OliverK
OliverK's picture
Offline
Last seen: 3 years 5 months ago
Developer
Joined: 2007-03-27 15:21
sounds like its time for a

sounds like its time for a virtual machine Smile

Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Fix

Now I know that computerfreaker is the only one who has tested it so far... he found a blazingly obvious bug: it couldn't launch anything, and said that there was "already another instance of  running" and to close it before running Thingummy Portable. I've fixed that here so if you want to try this out before I do another release, either make that patch to your PortableApps.comLauncher.nsi or check out the Mercurial repository (then you can also test running as admin!).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

solanus
solanus's picture
Offline
Last seen: 10 years 1 month ago
Joined: 2006-01-21 19:12
D'oh!

I saw the same thing when I did my Hugin update, but I thought it was my fault, because maybe I hadn't configured the ini properly!
It never occurred to me that it was an actual bug!

I did a workaround by setting
SingleAppInstance=false
which made it work.

I'll redo it with your fix after your next release.

I made this half-pony, half-monkey monster to please you.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
:D

Nice.

Please, please ask next time... Biggrin

(Oh good, I'm glad it wasn't completely broken ;-))

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
A bug and two patches

Just found another bug: WaitForOtherInstances will almost-certainly never do anything.
I turned on the DEBUG option, and got the message "Waiting till any other instances of ThunderUSB\ThunderStarter.exe are finished."; however, FindProcDLL::FindProc is looking for an executable name, not a path. I got bitten by this while I was trying to create a patch for a related feature, and ended up using this code to get around it:

${ParseLocations} $1
${GetFileName} $1 $1
FindProcDLL::FindProc $1

That worked, so here's a patch for WaitForOtherInstances.

		;=== Wait till it's done {{{3
			${ReadLauncherConfig} $0 Launch WaitForOtherInstances
			${If} $0 != "false"
				${DebugMsg} "Waiting till any other instances of $PROGRAMEXECUTABLE are finished."
				${Do}
					Sleep 1000
                                        StrCpy $1 $PROGRAMEXECUTABLE
                                        ${ParseLocations} $1
                                        ${GetFileName} $1 $1
					FindProcDLL::FindProc $1
				${LoopWhile} $R0 = 1
				${DebugMsg} "All instances of $PROGRAMEXECUTABLE are finished."
			${EndIf}

I haven't tested that, since I don't have any restarting apps I'm working on, but it should work.

Also, I have a patch to add a new feature: waiting for other programs to finish. Here's the patch, to be inserted immediately after the WaitForOtherInstances code and just before the Remove TEMP dir code:

        		${ForEachINIPair} "WaitForProgram" $0 $1
                  		${DebugMsg} "Waiting until $1 is finished."
                            		${Do}
                                             Sleep 1000
                                             ${ParseLocations} $1
                                             ${GetFileName} $1 $1
                                             FindProcDLL::FindProc $1
                                        ${LoopWhile} $R0 = 1
                        ${EndForEachINIPair}

To use the new feature, create a new section in launcher.ini; it should look something like this:

[WaitForProgram]
MyApp=SomeApp.exe

EDIT: it occurred to me that, since the two patches are right next to each other, I should probably merge them into one patch to make life easier for people. The comments at the top and bottom are simply for placeholders; match the comments in my patch to the comments in the launcher code, and you've got the patch placed correctly.

		;=== Wait till it's done {{{3
			${ReadLauncherConfig} $0 Launch WaitForOtherInstances
			${If} $0 != "false"
				${DebugMsg} "Waiting till any other instances of $PROGRAMEXECUTABLE are finished."
				${Do}
					Sleep 1000
                                        StrCpy $1 $PROGRAMEXECUTABLE
                                        ${ParseLocations} $1
                                        ${GetFileName} $1 $1
					FindProcDLL::FindProc $1
				${LoopWhile} $R0 = 1
				${DebugMsg} "All instances of $PROGRAMEXECUTABLE are finished."
			${EndIf}
			
        		${ForEachINIPair} "WaitForProgram" $0 $1
                  		${DebugMsg} "Waiting until $1 is finished."
                            		${Do}
                                             Sleep 1000
                                             ${ParseLocations} $1
                                             ${GetFileName} $1 $1
                                             FindProcDLL::FindProc $1
                                        ${LoopWhile} $R0 = 1
                        ${EndForEachINIPair}

		;=== Remove custom TEMP directory {{{3

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Thanks

I picked it up with the "already running" abort but forgot about the "check running" bit. I've fixed that now.

As for your second one, it's not practical to have more than one (which I have already put in as WaitForEXE); the way you have it would require the first process to finish, then the second, then the third, etc. What you need is just a list of processes to check for at the same time, but with only about 18 spare registers it's not practical. And the code would get too messy with up to 18 supported. So just one is good, I think. It could be done as a semicolon-separated list, but I don't think it's worth it.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Re:

Chris MorganAs for your second one, it's not practical to have more than one (which I have already put in as WaitForEXE); the way you have it would require the first process to finish, then the second, then the third, etc. What you need is just a list of processes to check for at the same time, but with only about 18 spare registers it's not practical. And the code would get too messy with up to 18 supported. So just one is good, I think. It could be done as a semicolon-separated list, but I don't think it's worth it.

No, that's not how mine works; I thought it through before coding it. Here's a sample scenario:

Imagine you've got 10 processes, Process1 through Process10, that you're waiting for.

WaitForProgram checks Process1, sees it's running, and waits until Process1 terminates.
Process3 finishes its task and ends.
Process1 ends.
WaitForProgram checks Process2, sees it's running, and waits until Process2 terminates.
Process2 ends.
WaitForProgram checks Process3, sees it's running, and waits until Process4 terminates.
Process6, Process7, and Process8 end.
Process4 ends.
WaitForProgram checks checks Process5, sees it's running, and waits until Process5 terminates.
Process10 ends.
Process5 ends.
WaitForProgram checks Process6, sees it's not running; checks Process7, sees it's not running; checks Process8, sees it's not running; checks Process9, sees it's running, and waits for Process9 to terminate.
Process9 ends.
WaitForProgram checks Process10, sees it's not running, and exits the For loop.

Even if Process1 is the last process to end, WaitForProgram won't be fazed at all. And the best feature: you can have an almost-unlimited list of processes to wait for. (I'd assume there's some constraint, but idk what - probably RAM)

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
That's the problem

This is exactly what I was trying to say. What if another instance of Process1 is started while the launcher is waiting for Process7 to quit? The secondary launcher will see that there's another copy of the launcher waiting to clean up afterwards: the problem is that it'll clean up after its list of processes finish in that order: and thus the secondary instance will have its data cleaned up around it and may mess things up badly as well as leaving things behind.

I have yet to think of any real use case beyond one (a second level of launcher), and I think there are problems with your implementation mainly in how it would be perceived and almost certainly misunderstood - that it doesn't in fact make sure that none of these processes are running. Just that it can go through them and check.

You could have a flag to indicate a clean run through, so that it would try and get to the last one and then run through them all again making sure that none of them exist, but I don't think it's worth it myself. I could do it though.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Shoot, you're right

That hadn't occurred to me.

I'll fix my implementation as soon as possible, although I have to think there's a better way of doing it. (Still, it's hard to use a better way if nobody can think of one.)

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Two more bugs and a patch

Well, I've found a couple more bugs; I've got a patch for one, but I don't know about the other yet.

Bug #1: PAL tries restoring data files from their backups even though there isn't a backup to restore from.

Patch:

		;=== Save portable settings and restore any backed up settings {{{3
			;=== Files {{{4
			;=== FilesMove {{{5
			${ForEachINIPair} "FilesMove" $0 $1
				${ParseLocations} $1
				${GetFileName} $0 $2
				StrCpy $1 $1\$2

				${If} $RUNLOCALLY != "true"
					${DebugMsg} "Copying file from $1 to $DATADIRECTORY\$0"
					Delete "$DATADIRECTORY\$0"
					CopyFiles /SILENT $1 "$DATADIRECTORY\$0"
				${EndIf}
				${DebugMsg} "Removing portable settings file $1 from run location."
				Delete $1

				${IfNot} ${FileExists} "$1-BackupBy$AppID"
					${DebugMsg} "Moving local settings file from $1-BackupBy$AppID to $1"
					Rename "$1-BackupBy$AppID" $1
				${EndIf}
			${EndForEachINIPair}

should be

		;=== Save portable settings and restore any backed up settings {{{3
			;=== Files {{{4
			;=== FilesMove {{{5
			${ForEachINIPair} "FilesMove" $0 $1
				${ParseLocations} $1
				${GetFileName} $0 $2
				StrCpy $1 $1\$2

				${If} $RUNLOCALLY != "true"
					${DebugMsg} "Copying file from $1 to $DATADIRECTORY\$0"
					Delete "$DATADIRECTORY\$0"
					CopyFiles /SILENT $1 "$DATADIRECTORY\$0"
				${EndIf}
				${DebugMsg} "Removing portable settings file $1 from run location."
				Delete $1

				${If} ${FileExists} "$1-BackupBy$AppID"
					${DebugMsg} "Moving local settings file from $1-BackupBy$AppID to $1"
					Rename "$1-BackupBy$AppID" $1
				${EndIf}
			${EndForEachINIPair}

Bug #2: for some reason, PAL really struggles with copying multiple files. Regardless of whether I use a wildcard (*) or explicitly list each file, something invariably gets left in App when it should get moved back to Data. No idea what's up with this one yet.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
#1 fixed

Thanks, I've now fixed that first one (in future, it's helpful having smaller patches - your patch was just turning ${IfNot} into ${If} but I had to go through the whole block to make sure).

I'll investigate #2 some time soon (but probably not today as I'm running out of time).

Thank you very much for helping find and fix these bugs.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Re:

Chris MorganThanks, I've now fixed that first one (in future, it's helpful having smaller patches - your patch was just turning ${IfNot} into ${If} but I had to go through the whole block to make sure).

Sorry about the size of the patch; I had assumed that people would be selecting part of the existing launcher and replacing it with my patch, which is why I made the patch so big: so people can find the appropriate spot in the launcher easily.

Time to get more familiar with WinMerge, I think.

Chris MorganI'll investigate #2 some time soon (but probably not today as I'm running out of time).

I already have a pretty good idea what the problem is, thanks to the debug messages.
"Copying D:\DOCS\Programming\PAF\ThunderUSB\Data\*.ini to D:\DOCS\Programming\PAF\ThunderUSB\App\*.ini" - I don't think it should be doing that. Something more like this, perhaps: "Copying D:\DOCS\Programming\PAF\ThunderUSB\Data\*.ini to D:\DOCS\Programming\PAF\ThunderUSB\App".
I could probably hack something together to strip down to the last directory during a copy operation, but I don't want to screw up anything (e.g. variables or registers) by adding another macro, and I'm not familiar enough with NSIS to do it elegantly. My patch would probably just look for the last backslash and delete everything after it, but there's probably a better way.
Incidentally, the backup code has the same problem: "Backing up D:\DOCS\Programming\PAF\ThunderUSB\App\*.ini to D:\DOCS\Programming\PAF\ThunderUSB\App\*.ini-Backup by ThunderUSB Portable" - I have to wonder how NSIS would handle that. Probably not well.

Chris MorganThank you very much for helping find and fix these bugs.

My pleasure!

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Services (and drivers)

I have now implemented services and drivers. Documentation is available in help.html. I haven't tested it at all. Replacing existing services is not yet supported. (It's just occurred to me that I may be able to rename the service rather than delete and recreate afterwards. I'll have to look through MSDN again. I'm really quite liking working with the Windows API...) If things go wrong in the application running, they're likely to mess up things from a portability point of view. I would advise any people testing services to do so in a revertible virtual machine. And I also really would like people to test it.

I'll be looking at computerfreaker's issue (computerfreaker, could you try the latest version from the repository and see if it's still happening? I may have fixed it incidentally) and once I've got that sorted out I'll do another release.

Please, please, does anyone know of a way to get a null byte in NSIS? I've tried putting one in a string literal (compile failed), FileReadByte, ReadINIStr, IntFmt $1 %c 0, they return an empty string. It doesn't look to me as though NSIS supports null bytes. If I can't do it multiple dependencies for services won't work.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

Of course they return an empty string--NSIS is written in C++; strings in both C++ and C are null-terminated. Therefore if you have a string containing a null byte, string manipulation functions will treat the null as an "end of string" indicator. Which is why I never understood why some Windows API functions treat it as a separator instead--sure, you can build the initial string easily, but if you try to print it out or use it directly (e.g. for logging/debugging purposes), you'll only be able to see the first entry.

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
NULL

Looks like you're right about NSIS not having nulls: https://portableapps.com/node/12561#comment-77050

btw, I'll probably grab the latest version from the repo tomorrow - I'm in a hurry atm, and the rest of today is almost-certainly going to be the same way.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Null byte

It's not NULL I need, it's a null byte - ASCII character 0. I can easily create one in Vim (Ctrl+V 000), but that doesn't help me as NSIS doesn't appear to support it at all Sad

Looks as though my service support is limited to one service dependency.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

xuesheng
Offline
Last seen: 10 months 2 weeks ago
Joined: 2008-03-21 15:34
Null bytes can be used in NSIS

If you need null bytes for an API call you can use the System plugin to allocate a structure and then store the necessary data in it.

There are some examples in the NSIS Support Forum:

http://forums.winamp.com/showthread.php?s=&threadid=146196
http://forums.winamp.com/showthread.php?s=&threadid=172312

(more examples can be found in that forum)

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Thanks

I'll bear that in mind soon and may switch back from the SimpleSC plug-in which I've gone with for the moment (it accepts dependencies slash-separated and converts them internally to null) to NSIS code.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Release: 1.0 Alpha 2

1.0 Alpha 2 has now been released. Read the release notes for the release notes.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Still having problems

Sorry, but it's still having all kinds of problems sending files back from App\ThunderUSB to Data.
I activated debug again, and it looks like only the first file is actually handled; I get the copying message and the removing message for the first file, and can confirm that the first file is actually moved. After that, no copying messages, no removal messages, and none of the other files actually go anywhere.
Looks like a problem in ForEachINIPair, although I can't imagine what as it works fine when copying from Data to App\ThunderUSB.

Here's my launcher.ini, in case you want to look at it: http://pastebin.com/m59a1d55a

I'll do a bit more digging and see what I can see.

EDIT: one of my original theories has been confirmed; while it won't solve the whole problem, it'll definitely help.
NSIS can't handle wildcards when renaming or copying files; for example,
CopyFiles "$SETTINGSDIRECTORY\*.ini" "$EXEDIR\App\${DEFAULTAPPDIR}\*.ini"
fails. This works, though, and has the same effect as the one originally intended:
CopyFiles "$SETTINGSDIRECTORY\*.ini" "$EXEDIR\App\${DEFAULTAPPDIR}"

Same deal with rename: if there's a wildcard in the new filename, the call fails.
ReName "$EXEDIR\App\${DEFAULTAPPDIR}\*.ini" "$EXEDIR\App\${DEFAULTAPPDIR}\*.ini-BackupByMyAppPortable"
fails, and there doesn't seem to be an acceptable alternative other than handling each file one-by-one.

EDIT 2: The rest of my theory has been confirmed.
I took the PAL source, shot it full of DebugMsg commands, and finally got the error message I wanted: "Error copying D:\DOCS\Programming\PAF\ThunderUSB\App\AccessibleGutenberg.ini to D:\DOCS\Programming\PAF\ThunderUSB\Data\AccessibleGutenberg.ini"; sure enough, the file isn't copied.

			ClearErrors
			${ForEachINIPair} FilesMove $0 $1
				${ParseLocations} $1
				${GetFileName} $0 $2
				StrCpy $1 $1\$2

				${If} $RUNLOCALLY != true
					${DebugMsg} "Copying file from $1 to $DATADIRECTORY\$0"
					Delete $DATADIRECTORY\$0
					;IfErrors 0 +2
					;${DebugMsg} "Error deleting $DATADIRECTORY\$0"
					CopyFiles /SILENT $1 $DATADIRECTORY\$0
					IfErrors 0 +2
					${DebugMsg} "Error copying $1 to $DATADIRECTORY\$0" ;This is the error that fired
				${EndIf}
				${DebugMsg} "Removing portable settings file $1 from run location."
				Delete $1
				IfErrors 0 +2
				${DebugMsg} "Error deleting $1"

				${If} ${FileExists} $1-BackupBy$AppID
					${DebugMsg} "Moving local settings file from $1-BackupBy$AppID to $1"
					Rename $1-BackupBy$AppID $1
					IfErrors 0 +2
					${DebugMsg} "Error renaming $1-BackupBy$AppID to $1"
				${EndIf}
				
			${EndForEachINIPair}

Once again, I'm going to guess NSIS isn't liking the file-on-file copy; in support of this, CopyFiles /SILENT $1 $DATADIRECTORY succeeds. However, PAL still ignores every entry but the first. Any ideas?

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Wildcards

On your last point of file wildcards, I'll support them some time but not, I expect, before 1.0. It'll require file iteration and a certain amount of temporary state saving for cleaning up (that's where I'm heading anyway, which is convenient).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
File-on-file copy

Anything on the file-on-file copy problems? That's probably the biggest problem atm, since I can just create a bunch of different explicit-move entries instead of using wildcards.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
No news yet

I can't see anything wrong with the code on my first look over so I'll have to look more closely at my ForEachINIPair macro (it's possible that it's got a stack bug or something like that).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Miscommunication

Sorry, I wasn't clear. This is what I meant:

computerfreakerI took the PAL source, shot it full of DebugMsg commands, and finally got the error message I wanted: "Error copying D:\DOCS\Programming\PAF\ThunderUSB\App\AccessibleGutenberg.ini to D:\DOCS\Programming\PAF\ThunderUSB\Data\AccessibleGutenberg.ini"; sure enough, the file isn't copied.

			ClearErrors
			${ForEachINIPair} FilesMove $0 $1
				${ParseLocations} $1
				${GetFileName} $0 $2
				StrCpy $1 $1\$2

				${If} $RUNLOCALLY != true
					${DebugMsg} "Copying file from $1 to $DATADIRECTORY\$0"
					Delete $DATADIRECTORY\$0
					;IfErrors 0 +2
					;${DebugMsg} "Error deleting $DATADIRECTORY\$0"
					CopyFiles /SILENT $1 $DATADIRECTORY\$0
					IfErrors 0 +2
					${DebugMsg} "Error copying $1 to $DATADIRECTORY\$0" ;This is the error that fired
				${EndIf}
				${DebugMsg} "Removing portable settings file $1 from run location."
				Delete $1
				IfErrors 0 +2
				${DebugMsg} "Error deleting $1"

				${If} ${FileExists} $1-BackupBy$AppID
					${DebugMsg} "Moving local settings file from $1-BackupBy$AppID to $1"
					Rename $1-BackupBy$AppID $1
					IfErrors 0 +2
					${DebugMsg} "Error renaming $1-BackupBy$AppID to $1"
				${EndIf}
				
			${EndForEachINIPair}

Once again, I'm going to guess NSIS isn't liking the file-on-file copy; in support of this, CopyFiles /SILENT $1 $DATADIRECTORY succeeds.

What I was trying to say is, NSIS doesn't seem to like an explicit file-on-file copy, just a file-to-directory copy.

*bug bump*

Could you change the file-on-file copy to file-to-directory copy instead? That seems to be working significantly better, especially with wildcards.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
DefaultData

Shouldn't you remove the sample stuff from DefaultData? It's pretty unprofessional if this is going to become an official release. The sample launchers are fine as they serve as a nice point of reference for new users, but the sample DefaultData files are useless.

Also the "virus" joke in the sample launcher.ini, while funny, might be seen by some as being in poor taste and should be taken out.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
OK, OK...

I've removed the DefaultData stuff. Originally I had intended as a basis the duplication of the PortableApps.com Launcher install directory, but that's not the way I want it done now as it ends up with a slight mess. So the DefaultData is not necessary at all. (It was there as a bit of a test; now I think I'll create a separate branch with a test suite sort of thing if I get round to it, which will actually work.)

As for the service description, that just happened to be what came out the top of my head when I was typing it. I've made it more innocuous.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Feature request:

I'm currently upgrading my Inno Setup launcher to PAL from CPAL Test 5, but I found I'd like a certain behavior that I can't achieve currently: Inno Setup uses the registry, so obviously you don't want the portable to run at the same time as a local copy, or they'd step on each other's toes. The problem is that if I set SingleAppInstance to true to accomplish this, now I can't run multiple portable instances either, when that would otherwise be fine.

Also, any chance you could update the help.html to list the default values for each of the launcher.ini directives? It'd help me immensely when deciding whether or not to add a directive if I knew what its default value was (this way I could leave it out if the default was okay).

Edit: Okay, I just noticed you have the default values bolded, but that's too subtle; especially with the values in monospace, the bolding is almost invisible. A format like the one used in the Inno Setup docs would be better:

KillEmAll (values: true or false - default: true)

Less confusion that way too, as the intent of the bolding--even if you do notice it--isn't immediately obvious.

Edit 2: In the documentation for WaitForOtherInstances: "If the application can restart itself at all, e.g. Firefox can, DO NOT set this to true..." Don't you mean "DO NOT set this to false"?

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Re:

BruceI'm currently upgrading my Inno Setup launcher to PAL from CPAL Test 5, but I found I'd like a certain behavior that I can't achieve currently: Inno Setup uses the registry, so obviously you don't want the portable to run at the same time as a local copy, or they'd step on each other's toes. The problem is that if I set SingleAppInstance to true to accomplish this, now I can't run multiple portable instances either, when that would otherwise be fine.

Anything wrong with CloseEXE? You could use that to make sure the local Inno gets shut down before the portable one can run.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

That has the same problem as SingleAppInstance--it'll pick up a portable instance as well.

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Did you test?

Did you test it? I just looked at the source code, and the CloseEXE code runs long before the portable instance runs.
nvm, I see what you mean: if you're starting a second portable instance, it'll pick up the first.

Any suggestions on how to handle this, Bruce? I can't commit any changes to the repo, but I can post patches on here, and if you can come up with a good solution, I can take that and run with it.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

The only way I can think right now to make it work is to test whether or the not the detected process belongs to the portable app or not, but I'm pretty sure you need admin privileges to get the full path of a process, so it seems we're at an impasse here... Sad

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Interesting idea

That's an interesting idea.
I'm pretty sure you don't need admin rights; you just need rights equivalent to, or higher than, the rights of the process you're trying to get the path to. Of course, that would probably wreak havoc on apps that require admin rights, but maybe we can work around it.
I'll see if I can catch Chris in IRC so we can discuss this further.

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 31 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Currently

Currently, all apps that support multiple instances have this issue. If the user launches a local one, the launcher will stick around thinking it's a portable one. There's no real workaround. On some, even disabling the ability to launch multiple instances won't fix it because the app will sometimes restart when you do updates like install a plugin (see Notepad++ and it's plugin manager).

If need be, we can leave this as a known issue for now because it's pretty unlikely that a user will end up in that situation. The major apps that you're gonna find on a local PC like FF, OO.o, Pidgin, etc don't have this issue.

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Thanks

Bold showed up really well (really well) with the monospace font used in Ubuntu. It didn't occur to me that Courier New's bold doesn't show up so well. I've put a note in at the top to the effect that default values are bold. I don't want to put "Default: ___" each time really, it makes it not as neat.

I've corrected the WaitForOtherInstances documentation, thanks.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

I don't want to put "Default: ___" each time really, it makes it not as neat.

It's not a beauty contest--this is about clarity. If you fix the too-subtle bolding I can deal with it, but otherwise I would prefer a separate listing for the default value.

Also I fail to see how "values: true or false [default: true]" is messy. As long as it's on the same line it's fine.

Edit: Okay, how about a compromise:

values: [true] or false

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Now underlined as well

I think that once you know the default values are bold, you should be able to see them well. Having the default value bold is very common practice. Underlined is also sometimes done. Maybe I'll do that then, like the NSIS User Manual. Bold and underlined.

There.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Yeah, that's better.

Sorry, but just the bold wasn't enough; whatever font Chrome was using for the monospace, the bolding was way too subtle. Before, even after I figured out the defaults were bold, I still had to squint to tell the difference. Not optimal at all.

Not trying to be a pain in the ass here, just looking out for the users. PAL really is awesome. Smile

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

Apparently help.html needs a serious once-over. I just found another error--the example for DirectoriesMove:

AppName=%APPDATA%

Given the description of how DirectoriesMove works ("%DATADIRECTORY%\from\*.* gets copied to to\*.*"), won't that cause the user's entire %APPDATA% tree to be copied to Data\AppName? That could be a disaster if someone actually tries that example.

Edit: Hmm. Apparently the splash screen wreaks havoc with full-screen games. I tried using PAL to portabilize the RPG I'm working on, but if the splash doesn't disappear by the time the game starts, when PAL finally hides it it causes the game to minimize itself. I then have to click its taskbar button to pull it back up.

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 31 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Delay

Maybe a LaunchAppAfterSplash=true line so that the launcher doesn't launch the actual app until the splash disappears?

Sometimes, the impossible can become possible, if you're awesome!

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
More commits

Yep, sorry about the AppName=%APPDATA% thing. Maybe I should get rid of the inline example and say refer back to the top for examples. I've fixed it. You're right though, it would wreak havoc if anyone did that: it would rename %APPDATA% to %APPDATA%-BackupBy$AppID... which would not be a good thing for the computer (I think it also wouldn't work on Vista).

I've implemented [Launch]:LaunchAfterSplashScreen.

Thanks for helping out Smile

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
BUG!

I'm making a launcher for HxD and I just discovered a pretty big bug: It seems if you have a DefaultData which doesn't contain AppNamePortableSettings.ini and launcher.ini specifies drive letter substitutions, all bare slashes are replaced with the drive letter. To illustrate, this is what HxD.ini normally looks like:

[\Position\FormMain\]
Left=25
Top=25
Width=720
Height=400
WindowState=3

[\]
...

etc.

Well, when the launcher gets hold of that, the file ends up looking like this instead:

[L:\PositionL:\FormMainL:\]
...

[L:\]
...

etc.

So yeah, you might want to fix that. Blum Note that after the first run it's fine (since the launcher has since created AppNamePortableSettings.ini with the correct drive letter), but it does screw up the initial state for the first run.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Eek

Yep, I can see exactly what that is. I've put in a check to make sure that $LASTDRIVE isn't empty.

Nice and easy to fix, thanks Smile

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
A number of commits

Here is notification of a number of commits I've done today. Computerfreaker's issue with FilesMove has, I think, been resolved (in fact it will work better than it did before for moving on the same volume, as it will use Rename rather than CopyFiles and Delete. Now I have to repeat it for DirectoriesMove as well. I've also fixed RegistryValueBackupDelete so that it works and cleaned up a few minor potential future issues. As usual, you can view the changes or check out the repository through hgweb.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Estimate?

Any estimate on the next release? The slash-replacement bug in particular has the potential to be pretty nasty, so I think it'd be best to get the fix out there as quickly as possible.

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Another bug?

The launcher.ini for my NoteCase launcher:

[Launch]
ProgramExecutable=NoteCase\notecaselauncher.exe
WaitForEXE=notecase.exe
SingleAppInstance=false

[LiveMode]
CopyApp=true

[FilesMove]
settings\notecase.ini=%APPDIR%\NoteCase\config

[FileDriveLetterUpdate]
Backslash1=%DATADIR%\settings\notecase.ini
Forwardslash1=%DATADIR%\settings\notecase.ini

How NoteCase's own portable version (which I'm using for this) works is that you run notecaselauncher.exe, which in turn runs notecase.exe then quits. This is why I have WaitForEXE=notecase.exe in [Launch]. Problem is, PAL isn't waiting for notecase.exe--once notecaselauncher.exe terminates, PAL quits.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Short-circuit their launcher

First of all, I would recommend that you see if you can skip using notecaselauncher.exe altogether: using Process Explorer, take a look at the notecase.exe image, command line (any special arguments) and environment variables in particular and see if you can emulate it and make it unnecessary. (Also if you could make it go straight in Data without needing to have a FilesMove back and forth.)

Are you working from Alpha 2 or the mercurial repository? If the latter, I recommend that you get the latest code and test it on it. I've got a feeling I touched something there which might have incidentally fixed it.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

Alpha 2. I don't know how to use Mercurial--I'm only familiar with CVS.

As for notecaselauncher.exe, I actually did that earlier (examining it with Process Explorer), and found quite a few NOTECASE_ environment variables. So I was thinking about nixing the intermediate launcher myself, but then I realized, notecaselauncher is doing other stuff besides just setting environment variables--for instance, allowing it to use the included portable GTK--and I don't know how I would handle stuff like that with PAL.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Clone the repository

Get Mercurial.

mkdir launcher
cd launcher
hg clone http://portableapps.hg.sourceforge.net/hgweb/portableapps/launcher/

If you want to get TortoiseHg instead, create a directory and select the TortoiseHg Clone context menu item in it.

To update to the latest revision,

hg pull
hg up

Or equivalent (probably just "update") in TortoiseHg.

You will need NSIS Portable 2.46 as well.

GTK stuff shouldn't need anything special (I think that'll have been a compiling/linking option). Do try skipping notecaselauncher.exe and see what happens.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Wow, that was easy

So much simpler and concise than CVS. With CVS you absolutely need a tool like Tortoise, but Mercurial... wow, I wasn't expecting it to be that painless. I'll have to keep it in mind for my own projects. Smile

Not sure what the benefits of Mercurial keeping the repository local is, though (other than disaster recovery of course). I mean, you still need to have a centralized location for the main repository either way if you want collaboration.

Edit: Yep, works perfectly. Thanks! I'll still try to bypass notecaselauncher though, just not right now. Out of curiosity, what's the change you made that fixed the bug?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Good

I'm glad that fixed it.

Cloning the repository is just the way distributed version control systems work. It's just like a working copy in SVN or whatever-it-is that CVS has but better as it contains all the project history (making many operations much faster). You can check out just the latest revision with hg but I can't remember how. It's simpler in Bazaar.

If you're eager you could track down the exact change I made... I think I was using the wrong variable in there somewhere and fixed it.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
ThunderUSB = success!

Well, I made two very interesting discoveries tonight.
First, VCS is much like the command-line in Linux: a pain to get used to, but eventually it gets easy and even intuitive. I'm closer to the "pain" part, but I did manage to clone the repo successfully.

Next, ThunderUSB is working with the latest PAL - w00t!! Biggrin
Thanks for the fix, Chris!

Now, three questions, all relatively unimportant.
#1: Can we do apps with services & drivers now? I see code for that, but I don't know how fully-implemented it is.
#2: Should I rewrite all my launchers (probably half-a-dozen atm) to use PAL?
#3: Can I keep using a custom launcher for KidSafe, so I can keep the custom icon & filename? (All the KidSafe launcher is doing is specifying a command-line variable; nothing complex)

Thanks again!

computerfreaker

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Sometimes it would be convenient to have no title at all.

I agree with you about most version control systems. I've never managed to get my ability with CVS past the extreme agony stage. (Drupal.org really should use a different version control system to CVS. It drives almost everyone that has to deal with it nowadays bonkers.)

  1. Services and drivers should work now. However, due to it being a potentially dangerous section of the computer to fiddle with, it'd be a good idea to do testing in a VM which you can revert easily should anything go wrong.
  2. At some point, yes. You decide when; you may wish to wait for the Beta and till it's a bit more stable and steady (I'm still doing lots of development at the moment).
  3. Filename isn't a problem, you can and should rename PortableApps.comLauncher.exe to KidSafePortable.exe. As for the icon, remember that the PortableApps.com Platform doesn't care about it. You decide, really. I think PAL should do fine.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

computerfreaker
computerfreaker's picture
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-08-11 11:24
Re:

1. Great! Mind if I try them out?
2. OK, I'll wait for Beta. I will keep helping test, though.
3. Cool! I guess I'll upgrade the KidSafe launcher to PAL.

Thanks!

"The question I would like to know, is the Ultimate Question of Life, the Universe and Everything. All we know about it is that the Answer is Forty-two, which is a little aggravating."

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Please do

Sure, please do try things out Smile

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Follow-up on NoteCase

I successfully got NoteCase working portably without using notecaselauncher.exe! As a bonus, the INI is now kept in Data\settings and not moved around at all. I'll post NoteCase Dev Test 1 a bit later. As far as free outliners go, NoteCase is awesome, and it doesn't appear we have an outliner yet, so hopefully it'll be well-received.

Process Explorer was indispensible for this. Actually, in the process I ended up portabilizing PE as well. If you couldn't tell I'm having a blast with PAL. Smile

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Good!

I'm glad that Angel you got NoteCase working and (b) PAL is your pal Smile

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Segments and EmptyWorkingSet

I've just committed the code I've been working on for the last while, which separates each chunk of functionality in the PortableApps.com Launcher a bit more. While doing this I noticed a few minor instances where things could potentially go wrong due to operations not being nested, so I've moved a few things around, and optimised secondary launches too. (This is a lot of the reason why I wanted to do this - to find things like that and make them easier to avoid in future.) So now instead of just PortableApps.comLauncher.nsi there are also 26 nsh files in a Segments subdirectory to do various things. I think I've got everything right with it.

The second item:
Rejoice with me, for I have found the thread I had lost! It was concerning launcher memory usage and a way to decrease it while just waiting for the sub-process to conclude. I have now implemented this EmptyWorkingSet but I can't really test it properly in Wine. What I expect to happen is that only 500KB-1MB or perhaps even less will be used while the launcher is waiting for the executable, rather than the usual 5-10MB or whatever it is now. I'd like someone to just quickly test that and make sure it's working as expected.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
PortableApps.com Launcher 1.0 Alpha 3 released

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Hmm

Just upgraded all my launchers to Alpha 3; all of them seem to be working great except for SharpDevelop, for which PAL seems to become trapped in an infinite loop after SharpDevelop closes, pegging the CPU indefinitely until I manually kill the process.

Here's my SharpDevelop launcher.ini:

[Launch]
ProgramExecutable=SharpDevelop\bin\SharpDevelop.exe

[LiveMode]
CopyApp=false

[DirectoriesMove]
profile=%APPDATA%\ICSharpCode\SharpDevelop3.0

[DirectoriesCleanupIfEmpty]
1=%APPDATA%\ICSharpCode

[FileDriveLetterUpdate]
Backslash1=%DATADIR%\profile\SharpDevelopProperties.xml
Backslash2=%DATADIR%\profile\LastViewStates.xml

This same launcher was working just fine with Alpha 2.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
SharpDevelop.exe

(Diagnosis stage.) Is SharpDevelop.exe running afterwards?

You should try coming into IRC, irc://irc.freenode.net/portableapps. I'm in there very regularly and it's very often easier to sort out issues there rather than back and forth in here.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Nope

SharpDevelop.exe has already shut down. Before it does, the launcher uses no CPU (as expected), once you close SD though, the launcher starts sucking CPU cycles like there's no tomorrow.

You know, these bugs would be so much simpler to track down if NSIS had a stepping debugger like Inno Setup...

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Looking at it now

I'm looking at it now. Can't work out quite what it is yet.

Since when has InnoSetup had a stepping debugger? Where? What? I would have thought that that was not at all practical considering the language structure - INI except for the [Code] blocks of Pascal.

PAL does have a DEBUG flag - currently a boolean, some time I'm going to put in different levels of debugging and the ability to just debug a given segment or given segments. If you want to debug as it is now, either compile PAL with "makensis -DDEBUG PortableApps.comLauncher.nsi" or uncomment the !define DEBUG line inside it.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

Don't know when it was introduced, but Inno Setup does have it:
http://stashbox.org/797070/ISDebug.png

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
Ahhhh

That was silly of me. Checking if an empty process name exists is causing an infinite loop.

Fixed, thanks.

Edit: we've discovered this was not the issue, the DirectoriesCleanupIfEmpty is. Now trying to work out what's going wrong as I can't see anything wrong with it.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
No good

Just checked out the latest code from Mercurial and compiled it with NSIS, but I'm still having the same problem with SharpDevelop. Inno Setup works fine though and its launcher.ini looks much like SD's, so I guess that wasn't it...

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
StrReplace

I think StrReplace (v4) is messing up $R0. Time to test that now.

Edit: good, I'm glad it wasn't my fault. Running a stack verification test on it shows that StrReplace is causing $R0 to end up with the value from $R1. Thus ParseLocations is causing $R0 to end up filled with $R1 which is empty, and so $R0 is emptied and $R0++ makes $R0 1 again. And so you end up with an infinite loop.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
WordReplace

I've now replaced StrReplace with WordFunc's WordReplace. There may be a miniscule performance decrease, but I don't think it should be much at all. My new variable replacement technique will be doing away with almost all use of (Str|Word)Replace anyway. Bruce, please test it again Smile

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Fixed

That fixed it, thanks. Smile Why did it break in the first place, though? If StrReplace was trashing the stack all along, shouldn't this issue have shown up before now?

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
No

Since Alpha 2 I'd switched from using $0 to $R0 for the loops to avoid confusion (I'd messed up one function for a bit due to using $0 for two things), and to $R9 for return values also.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Ah

Wait, so NSIS doesn't have proper (named) variables? Only registers and numbered variables? Geez, that must make maintenance a nightmare...

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
It does

There are named variables in NSIS as well as the built-in registers $0-$9 and $R0-$R9, but in general you use the built-in ones for short work. In many cases it's actually simpler than named variables.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Benedikt93
Offline
Last seen: 10 years 1 week ago
Joined: 2009-12-17 14:46
Feature request

Maybe you could include the possibility to only backup/restore single registry values and not only whole keys.
This would be important for example for the Run key. For portable applications this is of course not needed, but some applications may tend to rewrite this every run.

I think another good idea would be the possibility to enable a progressbar as some applications may need lots og registry keys to be copied which might take a long time. Or a least something showing that the launcher didn't just freeze.

At least the first point I think would be really important. I'll look at the PAL and maybe port my (and radarman36's) Steam Portable dev test to it.

"Der Klügere gibt nach, deshalb regieren Dumme die Welt."

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 31 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
No Run, Splash

No run keys should be backed up as otherwise you can have multiple portable apps stepping on each other's toes.

There's no need for a progressbar, that's what splash screens are for. And on that note, perhaps we could add a CloseSplashOnAppLaunch option so that for apps with lots to do ahead of time, the launcher can do everything it needs to and then close the splash on launching the app. Very very few apps will need this, but it may be nice for those that do.

Sometimes, the impossible can become possible, if you're awesome!

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
...

Re-read the post: That's why he suggested the ability to back up and restore individual values (NOT keys), so that you don't have multiple apps backing up and restoring the whole Run key and causing conflicts.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 5 months ago
Joined: 2007-04-15 21:08
RevistryValue(BackupDelete|Write)

For registry values I have RegistryValueBackupDelete and RegistryValueWrite; if you want to save the state of a registry value though you can't at the moment. I haven't really deemed it worth while working out. What John says about the Run key is right though; you shouldn't be writing to it. If something will write to it and you just want to chuck it away, you can use a RegistryValueBackupDelete value: 1=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\ThingummyQuickLaunch

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

Benedikt93
Offline
Last seen: 10 years 1 week ago
Joined: 2009-12-17 14:46
Another feature

Ok, this is enough for Steam, restore isn't necessary.

Another idea for a new feature:
Wildcards in registry keys

eg. "HKLM\...\...\SteamApp *" to Backup all keys that match this
eg SteamApp 440
SteamApp 320
and so on

EDIT: And some other:

  • ability to check the Windows version as some apps might require something like Xp and upwards
  • Add exceptions to the Windows firewall, maybe with the NSIS Simple Firewall Plugin
  • the ability to execute another program if the main executable doesn't exist, for example if App\Steam\Steam.exe isn't present execute App\Steam\Downloader.exe

"Der Klügere gibt nach, deshalb regieren Dumme die Welt."

Bruce Pascoe
Offline
Last seen: 12 years 11 months ago
Joined: 2006-01-15 16:14
Wait, what? o_O

That last one makes no sense. When you create the launcher.ini for a particular app you should already know what's (going to be) in the App folder. In what case would you ever be in doubt as to the correct executable to launch?

Also I'm fairly sure you can't qualify for a Windows logo if you silently add firewall exceptions like that--the option has to be presented to the user so they can decide for themselves whether or not they want to open another hole in their firewall.

Benedikt93
Offline
Last seen: 10 years 1 week ago
Joined: 2009-12-17 14:46
With the firewall I'm not

With the firewall I'm not sure, but with the SimpleFC Plugin you can also remove application from the exceptions, and at least this will be useful as these will be left otherwise.

For the alternate executable:
This will almost ever be useless. This was also related to my SteamPortable. It's not using the downloading option of the PA.c installer but uses it's own NSIS downloader because it's not sure if the user wants to download Steam or to copy a local installation.
But it's not important to be included for me as it would be easy to change the PAL a little bit to do so.

"Der Klügere gibt nach, deshalb regieren Dumme die Welt."

Pages

Topic locked