Skip to content

Commit

Permalink
Style: Shorten the exe suffix variable
Browse files Browse the repository at this point in the history
Change-Id: Id7b61cc70c97b3e859a0004bb206e970ca51f17e
Reviewed-by: Marcus Tillmanns <[email protected]>
  • Loading branch information
OrkunTokdemir committed Oct 7, 2024
1 parent 9166dcf commit 8b6891c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
9 changes: 3 additions & 6 deletions qt-cpp/src/kit-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as fs from 'fs/promises';
import * as commandExists from 'command-exists';

import {
PlatformExecutableExtension,
OSExeSuffix,
UserLocalDir,
createLogger,
QtInsRootConfigName,
Expand Down Expand Up @@ -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)
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions qt-cpp/src/util/get-qt-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions qt-lib/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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)))
);
}

Expand Down
4 changes: 2 additions & 2 deletions qt-qml/src/qmlls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
createLogger,
findQtKits,
isError,
PlatformExecutableExtension,
OSExeSuffix,
QtInsRootConfigName,
compareVersions,
GlobalWorkspace
Expand Down Expand Up @@ -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)
});
}
}
Expand Down
6 changes: 2 additions & 4 deletions qt-ui/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as constants from '@/constants';
import {
IsMacOS,
IsWindows,
PlatformExecutableExtension,
OSExeSuffix,
exists,
queryHostBinDirPath
} from 'qt-lib';
Expand All @@ -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) => {
Expand Down

0 comments on commit 8b6891c

Please sign in to comment.