Skip to main content
This document describes how self-updating works. The self-updating process has its own workflow which is triggered by the skin. Usually this happens when the skin first loads but it can also be triggered by the skin at any other time depending on how the skin was developed.

DIRECT 4.0-6.0.2

The self-update workflow consists of a start entry point which is triggered when the workflow is first started. In the start entry point, it checks to see if an update is required or not. If an update is required, it starts the self-update process. If no update is required, then the start task completes successfully. When updating occurs it is done through a repositorySync task that has the selfUpdate flag set to true . When this flag is set, it allows the client to overwrite existing in-use binaries using an operating system level trick that involves renaming and moving them to a temporary location. After the binaries are overwritten the client restarts itself and when it restarts it will check the temporary location for update files and remove them. The update tasks consist of the following:
  1. Download the self-update files to a pending directory
  2. Apply the self-update files
    1. If files cannot be overwritten in place, they are moved to a lock directory for later deletion
      1. On Windows the lock directory and the installation directory must reside on the same drive
  3. Shutdown the client
    1. Run a batch script
      1. Clean up files in lock directory
      2. Restart the client
    2. Close client

DIRECT 6.1

The self-update workflow consists of a start or state entry point that is used to check to see if an update needs to occur. If using the start entry point, it should proceed with the update if it finds one is necessary. However, if using the state entry point it should return an error indicating that an update is needed and the skin can initiate the self-update manually by triggering the update task. As part of the update task the self-update workflow does the following:
  1. Checks if we need to write to an elevated directory, and if so elevate
  2. Create unique temporary directory to store self-update pieces
  3. Download self-update pieces
  4. Copy the client to a the temporary directory
    1. On Windows & Linux this is the client executable
    2. On macOS this is the application bundle
  5. Set environment variables to be used by the restart child process
  6. Shutdown client and start copied client in temporary directory
  7. Copied client triggers the self-update workflow’s1 apply task2
    1. On macOS first delete the original application bundle
      1. This is done to prevent code-signing caching issues on macOS 113
    2. Apply self-update pieces
    3. Restart the original client using the environment variables from the original instance
The temporary directory is removed as part of the initial check for updates. Additional Notes
  1. The location of the self-update workflow can be configured in the app config.
  2. During the apply task DIRECT 6.1.0.113 or higher will show a native progress bar window in the event that the tasks requires a significant amount of time to complete.
  3. macOS would not launch the app after it had been self-updated even though all files and folders were identical and running from terminal showed “killed”, so the application bundle must be recreated during the self-update process.