You are here

NSIS PortableApps Installer Script (help please)

12 posts / 0 new
Last post
BrianAll
Offline
Last seen: 6 years 5 months ago
Joined: 2008-02-13 13:44
NSIS PortableApps Installer Script (help please)

I am compiling an PortableApps NSIS installer for the first time, rather than using an sfx archive. I have been working with the installer source code which is provided in about every app available on this site, but I am having trouble with the last bit of script:

Section "!App Portable (required)"
	SetOutPath $INSTDIR
	File /r "Files\*.*"  

This is where I specify the files to include in the installer, isn't it? 
Also, is there a special folder tree that the files and app must be in for the script to successfully finish? 
I am somewhat of a noob with NSIS :) ; I am just beginning to learn it. If someone can explain this to me I would appreciate it.

Thanks.
rab040ma
Offline
Last seen: 5 months 3 days ago
Joined: 2007-08-27 13:35
Unless you removed some

Unless you removed some comments in the section above, the sample you are copying from is fairly old.

The installer script should just work; the only things you need to change are between lines that are marked like ===Begin:... and ===End:....

The directory structure is pretty straightforward. Install the last several programs and look at them to see how they are laid out. Your layout should be exactly the same. That is, the PortableApps.comInstaller.nsi should be in Other\Source, the actual application files in App\[application name], and so forth.

Start with a clean copy of the latest installer and try to compile it. There is one "warning" error that can be ignored; if you see other errors, check for include files, plugins, and missing images, and try again. Don't make any changes to the script until it compiles. Then you can start changing the basic information (name of app, etc.). Test the compile every once in a while, to make sure you haven't messed something up.

The line you are pointing to above is telling the installer to copy some files. The script should (at that point) know what files need to be copied, unless you changed some things elsewhere in the script.

If you want to learn NSIS, you might want to start with something a bit simpler, like the Launcher for SumatraPdfPortable or maybe 7-zip Portable. Look up each command in the NSIS.chm file to see what it does, and see if you can follow the logic.

By the way, counter-intuitive as it may seem, to post a multi-line sample of code, enclose it in <pre> tags. The only way to know that is either to experiment or be one of the experienced developers; you have just joined the latter group. Wink

MC

BrianAll
Offline
Last seen: 6 years 5 months ago
Joined: 2008-02-13 13:44
Clean copy...

About that, is there somewhere I can get a clean base copy of the PortableApps installer? Without the app name, etc. already specified? Currently I am using one copied from an app that John made but have altered the app name.

My directoy structure is exactly as any other app, and the installer script is in the right place.
However, the script I was using had kept aborting because it could not open the icon files. It originally had this:

;=== Program Icon
Icon "Files\App\AppInfo\appicon.ico"

;=== Icon & Stye ===
!define MUI_ICON "Files\App\AppInfo\appicon.ico"
BrandingText "PortableApps.com - Your Digital Life, Anywhere™"

which I then changed to this:

;=== Program Icon
Icon "[app]Portable.ico"

;=== Icon & Stye ===
!define MUI_ICON "[app]Portable.ico"
BrandingText "PortableApps.com - Your Digital Life, Anywhere™"

using the icon in the scripts same directory.
Is the Files\app\appinfo\appicon.ico the right path, or should files have been something else? I think this might have something to do with the error, but a clean script would fix it.

(PS-Sorry for not using the pre tags but it crapped up and left half my post in with the script code Biggrin I'll have to figure that out)

rab040ma
Offline
Last seen: 5 months 3 days ago
Joined: 2007-08-27 13:35
Don't start changing the

Don't start changing the script until you have gotten it to work with one of John's releases. In other words, if you get errors compiling a release, you're going to have a huge problem getting it to compile against your own program.

Don't worry about having a copy that doesn't have names and such in it. Most of the stuff in the installer is designed so you only have to change the name of the application and such; the file references should be fine. In other words, who cares if the first time you compile your app the installer is named SumatraPDFPortable_en-us.exe or something -- you can always perfect it later.

Once the compile is working (with just the one warning) against an existing app, change one or two things at a time and compile. When you make a change and the compile stops working, you'll know what to fix.

~~~~~~~

If it cannot open the icon file, work on the icon file, not the script.

The icon file should be named appicon.ico and be located in App\AppInfo.

There are some icon formats that NSIS won't read. Get IcoFX and load an icon file that works with the installer (e.g. from a release). Look at the format(s) there. Then load the icon file for your app and make sure it has the same formats. Then save it as appicon.ico.

Try compiling your app with another app's appicon.ico, and see if it doesn't compile properly. Then you'll know that all you need is an ico file in the right format. You can open your app's executable with IcoFX and it will fetch out the icons from it; use that to create an ico file that is in the correct format.

MC

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

Grab a copy of PeaZip Portable for the current release (and one that is clean)

It is meant to reside in the Source directory in the layout of files used in all the apps released here. It gets the icon from AppNamePortable\App\AppInfo\appicon.ico. Nothing outside of the BEGIN/END comments needs to be changed.

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

BrianAll
Offline
Last seen: 6 years 5 months ago
Joined: 2008-02-13 13:44
GR8

Great, that should fix my problem.
I'm new, but have quickly caught on. I've got a few apps on the go right now; I am on spring break at the moment. I'll try to post these in the beta forums when they are done. Thanks a lot. Smile

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 11 years 2 months ago
Developer
Joined: 2005-12-10 15:22
I

think there are some unclosed tags in the top post, because in IE7 this page looks appaling with a giant font all over the place!

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

Even funnier: the text seems to magically get bigger and bigger as you scroll down!

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 11 years 2 months ago
Developer
Joined: 2005-12-10 15:22
Indeed

it does, I cant wait until the Drupal 6 upgrade so us normal mods can edit top level posts!

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

Even better, Drupal 6 automatically closes tags! Smile

PS - I think I fixed it. Like 6 unclosed code tags. Converted em to PREs anyway.

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

John Bentley
John Bentley's picture
Offline
Last seen: 15 years 3 months ago
Developer
Joined: 2006-01-24 13:26
That's good news. This font

That's good news. This font is getting huge!

cowsay Moo
cowthink 'Dude, why are you staring at me.'

BrianAll
Offline
Last seen: 6 years 5 months ago
Joined: 2008-02-13 13:44
Ooops..

Sorry about the font/html tag screw up. It was a little late here when I posted that, and I forgot to close the tags properly - duh. I use FF and not IE, and didn't notice it.

Log in or register to post comments