private static getRuntimeId()

in src/models/platform.ts [278:333]


	private static getRuntimeId(platform: string, architecture: string, distribution: LinuxDistribution): Runtime {
		// Note: We could do much better here. Currently, we only return a limited number of RIDs that
		// are officially supported.

		switch (platform) {
			case 'win32':
				switch (architecture) {
					case 'x86': return Runtime.Windows_7_86;
					case 'x86_64': return Runtime.Windows_7_64;
					default:
				}

				throw new Error(`Unsupported Windows architecture: ${architecture}`);

			case 'darwin':
				switch (architecture) {
					// Note: We return the El Capitan RID for Sierra
					case 'x86_64': return Runtime.OSX_10_11_64;
					case 'arm64': return Runtime.OSX_10_11_64;
					default:
				}

				throw new Error(`Unsupported macOS architecture: ${architecture}`);

			case 'linux':
				if (architecture === 'x86_64') {

					// First try the distribution name
					let runtimeId = PlatformInformation.getRuntimeIdHelper(distribution.name, distribution.version);

					// If the distribution isn't one that we understand, but the 'ID_LIKE' field has something that we understand, use that
					//
					// NOTE: 'ID_LIKE' doesn't specify the version of the 'like' OS. So we will use the 'VERSION_ID' value. This will restrict
					// how useful ID_LIKE will be since it requires the version numbers to match up, but it is the best we can do.
					if (runtimeId === Runtime.UnknownRuntime && distribution.idLike && distribution.idLike.length > 0) {
						for (let id of distribution.idLike) {
							runtimeId = PlatformInformation.getRuntimeIdHelper(id, distribution.version);
							if (runtimeId !== Runtime.UnknownRuntime) {
								break;
							}
						}
					}

					if (runtimeId !== Runtime.UnknownRuntime && runtimeId !== Runtime.UnknownVersion) {
						return runtimeId;
					}
				}

				// If we got here, this is not a Linux distro or architecture that we currently support.
				throw new Error(`Unsupported Linux distro: ${distribution.name}, ${distribution.version}, ${architecture}`);
			default:
				// If we got here, we've ended up with a platform we don't support  like 'freebsd' or 'sunos'.
				// Chances are, VS Code doesn't support these platforms either.
				throw Error('Unsupported platform ' + platform);
		}
	}