From 8b6891cb1fc41e9fa256e08bebea96e64609bdf3 Mon Sep 17 00:00:00 2001 From: Orkun Tokdemir Date: Wed, 2 Oct 2024 11:47:04 +0200 Subject: [PATCH] Style: Shorten the exe suffix variable Change-Id: Id7b61cc70c97b3e859a0004bb206e970ca51f17e Reviewed-by: Marcus Tillmanns --- qt-cpp/src/kit-manager.ts | 9 +++------ qt-cpp/src/util/get-qt-paths.ts | 4 ++-- qt-lib/src/util.ts | 10 +++------- qt-qml/src/qmlls.ts | 4 ++-- qt-ui/src/util.ts | 6 ++---- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/qt-cpp/src/kit-manager.ts b/qt-cpp/src/kit-manager.ts index 5e84761..81b33be 100644 --- a/qt-cpp/src/kit-manager.ts +++ b/qt-cpp/src/kit-manager.ts @@ -8,7 +8,7 @@ import * as fs from 'fs/promises'; import * as commandExists from 'command-exists'; import { - PlatformExecutableExtension, + OSExeSuffix, UserLocalDir, createLogger, QtInsRootConfigName, @@ -459,11 +459,8 @@ export class KitManager { ...newKit, ...{ compilers: { - C: path.join(mingwDirPath, 'gcc' + PlatformExecutableExtension), - CXX: path.join( - mingwDirPath, - 'g++' + PlatformExecutableExtension - ) + C: path.join(mingwDirPath, 'gcc' + OSExeSuffix), + CXX: path.join(mingwDirPath, 'g++' + OSExeSuffix) } } }; diff --git a/qt-cpp/src/util/get-qt-paths.ts b/qt-cpp/src/util/get-qt-paths.ts index 9ebf15b..1ef2c15 100644 --- a/qt-cpp/src/util/get-qt-paths.ts +++ b/qt-cpp/src/util/get-qt-paths.ts @@ -5,10 +5,10 @@ import * as path from 'path'; import * as fs from 'fs/promises'; import * as fsutil from '@util/fs'; -import { PlatformExecutableExtension } from 'qt-lib'; +import { OSExeSuffix } from 'qt-lib'; const QtToolchainCMakeFileName = 'qt.toolchain.cmake'; -const NinjaFileName = 'ninja' + PlatformExecutableExtension; +const NinjaFileName = 'ninja' + OSExeSuffix; async function pathOfDirectoryIfExists( dirPath: string diff --git a/qt-lib/src/util.ts b/qt-lib/src/util.ts index 3905e1c..4b86dff 100644 --- a/qt-lib/src/util.ts +++ b/qt-lib/src/util.ts @@ -14,7 +14,7 @@ export const IsMacOS = process.platform === 'darwin'; export const IsLinux = process.platform === 'linux'; export const IsUnix = IsMacOS || IsLinux; -export const PlatformExecutableExtension = IsWindows ? '.exe' : ''; +export const OSExeSuffix = IsWindows ? '.exe' : ''; export const UserLocalDir = IsWindows ? process.env.LOCALAPPDATA ?? '' : path.join(Home, '.local/share'); @@ -90,12 +90,8 @@ export async function queryHostBinDirPath( export async function locateQmakeExeFilePath(selectedQtPath: string) { return ( - (await existing( - path.join(selectedQtPath, 'bin', 'qmake' + PlatformExecutableExtension) - )) || - (await existing( - path.join(selectedQtPath, 'bin', 'qmake6' + PlatformExecutableExtension) - )) + (await existing(path.join(selectedQtPath, 'bin', 'qmake' + OSExeSuffix))) || + (await existing(path.join(selectedQtPath, 'bin', 'qmake6' + OSExeSuffix))) ); } diff --git a/qt-qml/src/qmlls.ts b/qt-qml/src/qmlls.ts index 0fdebbf..db3bda3 100644 --- a/qt-qml/src/qmlls.ts +++ b/qt-qml/src/qmlls.ts @@ -15,7 +15,7 @@ import { createLogger, findQtKits, isError, - PlatformExecutableExtension, + OSExeSuffix, QtInsRootConfigName, compareVersions, GlobalWorkspace @@ -195,7 +195,7 @@ async function findMostRecentExecutableQmlLS(): Promise< found.push({ qtVersion: version, - qmllsPath: path.join(qt, 'bin', 'qmlls' + PlatformExecutableExtension) + qmllsPath: path.join(qt, 'bin', 'qmlls' + OSExeSuffix) }); } } diff --git a/qt-ui/src/util.ts b/qt-ui/src/util.ts index e875452..4b44a40 100644 --- a/qt-ui/src/util.ts +++ b/qt-ui/src/util.ts @@ -8,7 +8,7 @@ import * as constants from '@/constants'; import { IsMacOS, IsWindows, - PlatformExecutableExtension, + OSExeSuffix, exists, queryHostBinDirPath } from 'qt-lib'; @@ -35,9 +35,7 @@ export async function delay(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } -const DesignerExeName = IsMacOS - ? 'Designer' - : 'designer' + PlatformExecutableExtension; +const DesignerExeName = IsMacOS ? 'Designer' : 'designer' + OSExeSuffix; export async function locateQtDesignerExePath(selectedQtPath: string) { const getDesignerExePath = (selectedQtBinPath: string) => {