Skip to content

JSON Config Files

GingerIndustries edited this page Jan 19, 2022 · 2 revisions

JSON Config Files

SSI uses a JSON-formatted configuration file to create its installers. These files have two parts, each representing a different part of the install process: Install and Setup. The Install step is where the installer downloads (and decompresses, if needed) the program and copies the files to the correct locations, and the Setup step is where the installer creates desktop shortcuts, registers file extensions, and the like. At the beginning of the file, there is also a header section with information on the program being installed.

Header

The header is the simplest part of the file, and contains information about the program being installed.

Parameter Usage
*name The name of the program
author The program's author
root Whether the program needs admin privleges to install

*Required

Example

"header": {
    "name": "Example Program",
    "author": "Ginger Industries"
}

Install

This section contains a list of URLs to download data from, along with where to copy that data to and how to decompress it.

Parameter Usage
*rootpath The root path of the program data
*targets A list of files to download (see below)

*Required

Target parameters

Parameter Usage
*url The URL to download from
*path The target location of the downloaded file
(relative to the root path)
*abspath The target location of the downloaded file
(relative to the root folder (i.e. /), can be used instead of path)
compression The compression type of the file
(any of "zip", "gzip", "tar", if not passed assumed to be uncompressed)

*Required

Notes

  • For absolute paths, "~" represents the current user's home folder.
  • For relative paths, an empty path represents the root folder. (i.e. if the root is /Programs/somefolder then an empty path would point to that.)
  • For compressed files, their root level will be what is extracted into the path. (i.e. if my archive contaians a folder containing more files, that folder will be placed at the path instead of the contents of the folder.)

Example

"install": {
    "rootpath": "/Program Files/Ginger Industries/Example Program/",
    "targets": [
        {
            "url": "https://raw.githubusercontent.com/Ginger-Industries/SSI/main/example_program/test.txt",
            "abspath": "~/AppData/Roaming/ExampleProgram"
        },
        {
            "url": "https://raw.githubusercontent.com/Ginger-Industries/SSI/main/example_program/example_archive.zip",
            "path": "",
            "compression": "zip"
        }
    ]
}

Setup

This section contains information about data like filetypes, desktop shortcuts, and similar.

Parameter Usage
shortcuts A list of desktop shortcuts to create
menuitems A list of desktop "start" menu items to create
filetypes A list of filetypes to register

*Required

Shortcut and menu item parameters

Parameter Usage
*target The command to run when the shortcut is clicked
*name The friendly name to show on the shortcut
icon The path to the icon image to use
(defaults to the target's icon if available, else uses the system default icon)
iconname The name of the icon to use (where supported, cannot be used with icon)

*Required

Filetype notes

  • In the target parameter, you can use %F for the file's path and %R for its URI.

Filetype parameters

Parameter Usage
*extension The extension to register
*name The name of the filetype (discarded if extension already exists)
*target The command to run when the file is clicked (see above for pathcodes)

*Required

Example

"setup": {
    "shortcuts": [
        {
            "target": "notepad",
            "name": "Notepad"
        }
    ],
    "filetypes": [
        {
            "extension": ".txt",
            "name": "Text",
            "target": "notepad %F"
       }
   ]
}

Full example

{
    "header": {
        "name": "Example Program",
        "author": "Ginger Industries"
    },
    "install": {
        "rootpath": "/Program Files/Ginger Industries/Example Program/",
        "targets": [
            {
                "url": "https://raw.githubusercontent.com/Ginger-Industries/SSI/main/example_program/test.txt",
                "abspath": "~/AppData/Roaming/ExampleProgram"
            },
            {
                "url": "https://raw.githubusercontent.com/Ginger-Industries/SSI/main/example_program/example_archive.zip",
                "path": "",
                "compression": "zip"
            }
        ]
    },
    "setup": {
        "shortcuts": [
            {
                "target": "notepad",
                "name": "Notepad"
            }
        ],
        "filetypes": [
            {
                "extension": ".txt",
                "name": "Text",
                "target": "notepad %F"
           }
       ]
    }
}