Skip to content

Fix mlint path on maca64 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions src/providers/linting/LintingSupportProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ class LintingSupportProvider {
* @returns The path to the mlint executable, or null if it cannot be determined
*/
private async getMlintExecutable (): Promise<string | null> {
const platformDir = this.getBinDirectoryForPlatform()
if (platformDir == null) {
const platformDirs = this.getBinDirectoriesForPlatform()
if (platformDirs == null) {
// Unable to determine platform
return null
}
Expand Down Expand Up @@ -352,28 +352,38 @@ class LintingSupportProvider {
return null
}

const mlintExecutablePath = path.normalize(path.join(
binPath,
platformDir,
'mlint'
))
for (const platformDir of platformDirs) {
const mlintExecutablePath = path.normalize(path.join(
binPath,
platformDir,
'mlint'
))
try {
await fs.access(mlintExecutablePath)
return mlintExecutablePath // return the first existing path
} catch {
// continue to the next iteration
}
}

Logger.error(`Error finding mlint executable in ${binPath}`)

return mlintExecutablePath
return null
}

/**
* Gets the name of platform-specific binary directory.
*
* @returns The binary directory name, or null if the platform is not recognized
*/
private getBinDirectoryForPlatform (): string | null {
private getBinDirectoriesForPlatform (): string[] | null {
switch (process.platform) {
case 'win32':
return 'win64'
return ['win64']
case 'darwin':
return 'maci64'
return ['maci64', 'maca64']
case 'linux':
return 'glnxa64'
return ['glnxa64']
default:
return null
}
Expand Down