You are here

Bug (3.0b1 rev 2): $APPDIR used instead of the declared $APPDIRPATH

9 posts / 0 new
Last post
The MAZZTer
The MAZZTer's picture
Offline
Last seen: 1 year 10 months ago
Developer
Joined: 2006-11-17 15:31
Bug (3.0b1 rev 2): $APPDIR used instead of the declared $APPDIRPATH

I was modifying the NSI for the launcher for another program, when I noticed this:

ReadEnvStr $APPDATAPATH "APPDATA"

Followed later by

IfFileExists "$APPDATA\Mozilla\Firefox\*.*" CheckForCrashReports

and

IfFileExists "$APPDATA\Mozilla\Firefox\Crash Reports\*.*" "" CheckIfRunning

$APPDATA is undeclared... I think you meant to put $APPDATAPATH.

John T. Haller
John T. Haller's picture
Online
Last seen: 56 min 22 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Not Exactly

I forgot to remove the APPDATAPATH declaration and environment string read. They're not necessary. NSIS populates APPDATA by default. So the launcher works bug free, but there's an extra variable that's populated and unused.

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

The MAZZTer
The MAZZTer's picture
Offline
Last seen: 1 year 10 months ago
Developer
Joined: 2006-11-17 15:31
Ah that was actually my

Ah that was actually my second guess. Wink But the NSIS CHM didn't have anything useful for "APPDATA" or "$APPDATA" when I searched it.

Signature automatically removed for being too awesome.

The MAZZTer
The MAZZTer's picture
Offline
Last seen: 1 year 10 months ago
Developer
Joined: 2006-11-17 15:31
Found another bug

StrCmp $PROFILEDIRECTORY $LASTPROFILEDIRECTORY "" AdjustChrome
StrCmp $DISABLEINTELLIGENTSTART "true" AdjustChrome
StrCpy $SKIPCHROMEFIX "true"
StrCpy $SKIPCOMPREGFIX "true"

AdjustChrome:

AdjustChrome is always called regardless of whether the directory name has changed since last run or intelligentstart is disabled.

Maybe this is what you want?

StrCmp $PROGRAMDIRECTORY $LASTPROFILEDIRECTORY "" AdjustChrome
StrCmp $DISABLEINTELLIGENTSTART "true" AdjustChrome
StrCpy $SKIPCHROMEFIX "true"
StrCpy $SKIPCOMPREGFIX "true"
Goto RunProgram

Signature automatically removed for being too awesome.

John T. Haller
John T. Haller's picture
Online
Last seen: 56 min 22 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Nope

Look two lines of code down. It dumps out of AdjustChrome if $SKIPCHROMEFIX is true, as it should. The label "AdjustChrome" is just a tad misleading.

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

The MAZZTer
The MAZZTer's picture
Offline
Last seen: 1 year 10 months ago
Developer
Joined: 2006-11-17 15:31
Ah, I got rid of those two

Ah, I got rid of those two SKIP variables in mine, and so my AdjustChrome (which is REALLY misleading since my program has no chrome) was getting called all the time.

I've actually got a suggestion regarding the usage of "Sleep 100" in the registry code of 7-zip Portable... calling regedit.exe directly with ExecWait would be a better way to wait for regedit to finish Saving a key to a file. I'll post my code for that when I've written it.

Signature automatically removed for being too awesome.

John T. Haller
John T. Haller's picture
Online
Last seen: 56 min 22 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Already Done

It's already done better than that in later launchers (7-Zip Portable is using the registry techniques from a year ago, so it's pretty outdated). It'll be updated now that a new version of 7-Zip has been released. See some of the other launchers like PuTTY for a better example of the current code.

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

The MAZZTer
The MAZZTer's picture
Offline
Last seen: 1 year 10 months ago
Developer
Joined: 2006-11-17 15:31
Thanks, the putty code does

Thanks, the putty code does some things better and should work better for my purposes (moving a key rather than exporting and importing 95k would seem to be faster, methinks :)).

Signature automatically removed for being too awesome.

Patrick Patience
Offline
Last seen: 4 years 11 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
OT

BTW, you're not supposed to have animated Avatars as stated on your account page.

Log in or register to post comments