inDeveloperMode method

bool inDeveloperMode()

Windows 10+ has a developer mode that needs to be enabled to create symlinks without escalated prividedges. For details on enabling dev mode on windows see: https://bsutton.gitbook.io/dcli/getting-started/installing-on-windows

Implementation

bool inDeveloperMode() {
  /// Example result:
  /// <blank line>
  /// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock
  /// AllowDevelopmentWithoutDevLicense    REG_DWORD    0x1
  final response =
      r'reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /v "AllowDevelopmentWithoutDevLicense"'
          .toList(runInShell: true, skipLines: 2)
          .first;
  final parts = response.trim().split(RegExp(r'\s+'));
  if (parts.length != 3) {
    throw InstallException('Unable to obtain development mode settings');
  }

  return parts[2] == '0x1';
}