Probably the last time i need to revise checking if binary exists. Bit annoying that windows returns 1 if it doesnt exist

This commit is contained in:
Noah Santschi-Cooney 2018-07-24 23:05:59 +01:00
parent bd546ab67f
commit 5e6a12c88b
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
2 changed files with 4 additions and 3 deletions

View file

@ -1,9 +1,10 @@
import { connection, documents, onEvent } from './server' import { connection, documents, onEvent } from './server'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import { platform } from 'os' import { platform } from 'os'
import { createWriteStream, chmodSync, createReadStream, unlinkSync, existsSync } from 'fs' import { createWriteStream, chmodSync, createReadStream, unlinkSync } from 'fs'
import * as unzip from 'unzip' import * as unzip from 'unzip'
import { postError } from './utils' import { postError } from './utils'
import { execSync } from 'child_process'
const url = { const url = {
'win32': 'https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip', 'win32': 'https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-windows-x64-Release.zip',
@ -22,7 +23,7 @@ export const onConfigChange = async (change) => {
const temp = change.settings.mcglsl as Config const temp = change.settings.mcglsl as Config
conf = {shaderpacksPath: temp['shaderpacksPath'].replace(/\\/g, '/'), glslangPath: temp['glslangValidatorPath'].replace(/\\/g, '/')} conf = {shaderpacksPath: temp['shaderpacksPath'].replace(/\\/g, '/'), glslangPath: temp['glslangValidatorPath'].replace(/\\/g, '/')}
if (existsSync(conf.glslangPath)) { if (!execSync(conf.glslangPath).toString().startsWith('Usage')) {
documents.all().forEach(onEvent) documents.all().forEach(onEvent)
} else { } else {
promptDownloadGlslang() promptDownloadGlslang()

View file

@ -223,7 +223,7 @@ function lint(uri: string, lines: string[], includes: Map<string, IncludeObj>, d
// TODO what if we dont know the top level parent? Feel like thats a non-issue given that we have uri // TODO what if we dont know the top level parent? Feel like thats a non-issue given that we have uri
diag = { diag = {
severity: errorType(type), severity: errorType(type),
range: calcRange(includes.get(nextFile).lineNum - (win ? 1 : 0), includes.get(nextFile).parent), range: calcRange(includes.get(nextFile).lineNum - 1, includes.get(nextFile).parent),
message: includes.get(file).path.replace(conf.shaderpacksPath, '') + replaceWords(msg), message: includes.get(file).path.replace(conf.shaderpacksPath, '') + replaceWords(msg),
source: 'mc-glsl' source: 'mc-glsl'
} }