launcherScript property

String get launcherScript

The launcher script content.

The POSIX script resolves symbolic links to itself (like one in /usr/local/bin), to find the bundle directory.

Implementation

String get launcherScript => targetsWindows
    ? '@echo off\r\n"%~dp0bin\\$name.exe" %*\r\n'
    : '#!/bin/sh\n'
          'p="\$0"\n'
          'while [ -L "\$p" ]; do\n'
          '  t="\$(readlink "\$p")"\n'
          '  case "\$t" in\n'
          '    /*) p="\$t" ;;\n'
          '    *) p="\$(dirname "\$p")/\$t" ;;\n'
          '  esac\n'
          'done\n'
          'exec "\$(dirname "\$p")/bin/$name" "\$@"\n';