• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

NSIS: Setting a default $INSTDIR

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
I was charged with creating an installer for the TC310R for X-Plane 11 yesterday. Since X-Plane 11 does not use the Registry to store any path information, I had to discover a way to at least set a default path for the installer to use. As it turns out this was far simpler than I thought it might actually be. :idea:

So for the benefit of anyone else faced with this issue, here is the solution:

Code:
Function .onInit
    InitPluginsDir
    StrCpy $INSTDIR "C:\X-Plane 11"
FunctionEnd
 

Heretic

Resource contributor
Messages
6,830
Country
germany
I wouldn't set a default path as X-Plane tends to get installed anywhere.

Unless you've alsready done so, you should have the installer copy the aircraft's root folder into a subfolder in "Aircraft", e.g. X-Plane 11\Aircraft\Milviz\TC310R. It'll prevent cluttering up the "Aircraft" folder.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
That is precisely what the installer does. I just didn't want the user to have a totally empty "box" and a Browse button. If they should happen to ignore that and click on "Install" then all the files would be installed on the root OS drive, but not within the scope of X-Plane 11's folder!

The script below will automatically create any needed sub-folders as it processes the files. At the end, the installer will launch the aircraft's manual.

Code:
  ${If} $RadioButton1_State == 1
    SetOutPath "$INSTDIR\Aircraft\Milviz\Milviz T310R"
    File /r "D:\Dropbox\Milviz Team Folder\Installer Build Folder\C310R-XP\Aircraft\Milviz\Milviz T310R\*.*"
  ${EndIf}
 
  ${If} $RadioButton1_State == 1
        ExecShell open "$INSTDIR\Aircraft\Milviz\Milviz T310R\CT310R_XP_User_Guide.pdf"
  ${EndIf}
The uninstaller will simply remove the aircraft and all of it's files, leaving the ..\Milviz folder present so as not to affect any other Milviz aircraft that may be installed.
Code:
;  PUT UNINSTALLER SCRIPT HERE!
Section

${If} $Checkbox2_State == 1
  SetOutPath "$INSTDIR\Aircraft\Milviz\"
  RMDir /r "$INSTDIR\Aircraft\Milviz\Milviz T310R\*.*"
${EndIf}

SectionEnd
 

Heretic

Resource contributor
Messages
6,830
Country
germany
I just didn't want the user to have a totally empty "box" and a Browse button.

But that's the most feasible solution!

If an inexperienced or absent-minded user has his/her XP11 folder on the desktop and your installer suggests "C:\X-Plane 11" by default, there is a risk of the user simply continuing the process, putting the aircraft folder into a totally unusable location and consequently triggering complaints about a non-showing add-on.

At least try to implement a check for any of XP's executable files and display a warning if it can't be found in the destination directory.

Also, what about Linux and iOS?


- Edit:

Just found out that "X-plane_install_11.txt" in "C:\Users\[username]\AppData\Local" contains all locations that X-Plane's installer was told to use for X-Plane's root folder, with the most recently used full directory path stated in the last line of the file.
 
Last edited:

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Odd that several hours of "Google-Fu" didn't yield that bit of information.

In any case it is now a moot issue. The 'boss' had forgotten about the possibility of Linux and/or iOS, so decided to scrap that installer completely. While I could build an installer for either of the above systems, it would be confusing maintaining three separate installers for a single project, especially given that none of the team members have or use Linux or iOS so we'd have no way to test 'em! :rotfl:
 
Last edited:

Heretic

Resource contributor
Messages
6,830
Country
germany
Odd that several hours of "Google-Fu" didn't yield that bit of information.

Don't worry, I only stumbled across it in the XP forums by chance.

In any case it is now a moot issue. The 'boss' had forgotten about the possibility of Linux and/or iOS, so decided to scrap that installer completely. While I could build an installer for either of the above systems, it would be confusing maintaining three separate installers for a single project, especially given that none of the team members have or use Linux or iOS so we'd have to way to test 'em! :rotfl:

So what are you going to do instead? Password protected archives? And how are you performing license checks? SASL?

I have XP11 configured for use on Arch Linux, so I could do a bit of testing, time permitting.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
I've no idea. There is an entirely different team working on the X-Plane project(s). I was only tasked with creating an installer for them, until sanity prevailed when they realized that said installer wouldn't cover all three OS platforms.
 
Top