Exercise 11.1 Magic Folders

In this exercise, we'll implement a new installer project that serves to demonstrate the use and flexibility of the InstallAnywhere Magic Folders architecture.

1.
Open InstallAnywhere and create a new project in the advanced designer.

Yes, at least for the moment, OfficeSuite will be retired.

2.
On your desktop (or in a location where you can easily find them), create the following files (they need not have any content):

Desktop.txt
SystemDriveRoot.txt
Home.txt
Temp.txt
Programs.txt
System.txt
MagicOne.txt
MagicTwo.txt

3.
Add all files you've just created to your installer project.

4.
Browse to the Files task.

For each file, we'll be choosing a Magic Folder that will result in the file being installed to a location that matches the filename. This will allow us to see the installation process in action and to see how the Magic Folders resolve.

5.
Set Magic Folder destinations for each file.

  1. For the Desktop.txt file, highlight the file and in the customizer use the pull-down menu to select Desktop Folder.

  2. Highlight SystemDriveRoot.txt and select System Drive Root.

  3. Highlight the Home.txt file and select Home Directory.

  4. Repeat, selecting the matching destination pathname, until reaching the MagicOne and MagicTwo files. For these files, select USER_MAGIC_FOLDER_1 and USER_MAGIC_FOLDER_2, respectively.

6.
Define the User Magic Folders that we've used.

As the folders must be defined before they're installed, we'll define them in the pre-install section of the installer.

  1. Browse to the Pre-Install task.

    As we're only exploring the Magic Folders in this installer, we can remove all the panels from pre-install. This will allow our installer to run more quickly and without interaction.

    Now, to define the User Magic Folders, we need to define the InstallAnywhere variables that define them.

  2. Add a Set InstallAnywhere Variable action by clicking Add Action, then in the General tab chose Set InstallAnywhere Variable—Single Variable.

    This action will define the $USER_MAGIC_FOLDER_1$ variable and, as such, define the location for the MagicOne.txt file.

  3. Select a location where you have write permissions and enter that path as the value for the file.

7.
Add another Set InstallAnywhere Variable action, which we'll use to define $USER_MAGIC_FOLDER_2$.

For this variable, try using one of the Magic Folder variables to help define the path. The variables used in Magic Folders are described in Appendix B. We suggest using something like $SYSTEM_DRIVE_ROOT$$/$MagicFolder. The $/$ will resolve to the proper “/”, “”, or “:” depending on the system used. It is one of the standard InstallAnywhere variables, and we suggest using it in place of the system-specific file separators.

8.
Build and run your installer.

After execution, you'll want to check each file location that you've specified with a Magic Folder to see if the file was correctly installed. The Desktop.txt file should appear on your desktop. The other files will appear in the locations that have been specified. The only tricky one here is the Home.txt file. This should appear in the user's home directory, which is highly variable. On most Windows systems this will be in C:Documents and SettingsUSERNAME, and of course on UNIX and derivative systems, it will be ~$USER.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.20.224.107