You are here

PAL and Source Code

11 posts / 0 new
Last post
dougakins
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2009-08-17 09:34
PAL and Source Code

Is there a way to get the PortableApps Launcher to generate a nsi file?

I have an old program I am trying to make portable for myself. Everything is working great, except that for in an ini file, I need to put in the short path (i.e. PROGRA~) instead of the full path.

If the launcher could output a nsi file, I could just add the /SHORT option and re-compile, but I wasn't sure if this was even possible.

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

You'll need to do this with custom code (using PAL 2.1, App\AppInfo\Launcher\Custom.nsh), using GetFullPathName /SHORT; here's one way you might do it:

${SegmentFile}

${SegmentInit}
    GetFullPathName /SHORT $0 $EXEDIR\App
    ${SetEnvironmentVariable} SHORTAPPDIR $0
!macroend

Then you could use this in launcher.ini like this:

[FileWrite1]
File=%PAL:DataDir%\data.ini
Type=INI
Section=Settings
Key=Path
Value=%SHORTAPPDIR%

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

dougakins
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2009-08-17 09:34
Thanks!

Thanks Chris that worked perfectly! Great job on the launcher too - great tool!

nnewton
Offline
Last seen: 2 years 9 months ago
Joined: 2007-07-06 02:14
Reviving the original

Reviving the original question, can we get the source NSI for the generated launcher?

Is there an option in launcher.ini that I'm not aware of? I pored through the docs but can't find any mention of an option that would do that.

I'd like to read through the source before executing the compiled EXE just to make sure it's doing everything correctly.

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

What is there is there. Not many options are determined at compile-time, etiher; most of launcher.ini is evaluated at runtime.

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

nnewton
Offline
Last seen: 2 years 9 months ago
Joined: 2007-07-06 02:14
Ahhh, OK. so the launcher in

Ahhh, OK. so the launcher in this case is just an interpreter. I thought it actually created the NSI then compiled it.

I'll guess I'll go back to manually creating the NSI then.

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 1 day 12 hours ago
DeveloperModerator
Joined: 2008-07-24 18:46
How come?

Is there something you're wanting to do that isn't possible with the launcher?

nnewton
Offline
Last seen: 2 years 9 months ago
Joined: 2007-07-06 02:14
Nothing in particular

Nothing in particular, but I was debugging my launcher.ini this morning trying to figure out what I was doing wrong, having the source NSI would have allowed me to see, step by step, what it was trying to do. I would have found the problem sooner.

It's all fixed now though.

depp.jones
Online
Last seen: 38 min 32 sec ago
DeveloperTranslator
Joined: 2010-06-05 17:19
You could always try

You could always try debugging step by step if you didn't already do that. That should give a good impression of what the launcher does at every single step.

John T. Haller
John T. Haller's picture
Offline
Last seen: 10 hours 36 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Not Quite

The launcher's NSI is compiled when you generate your launcher. Some of it is determined at runtime (whether to include certain plugins, name, icon, etc) but much of it is interpreted.

Please do not create new custom NSIS launchers for apps you would like to get to official release. PAL is more powerful, more stable and FAR easier to maintain.

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

nnewton
Offline
Last seen: 2 years 9 months ago
Joined: 2007-07-06 02:14
OK

I don't plan to submit any, the apps I make launchers for are usually non-FOSS.

Log in or register to post comments