Skip to content

Commit 3b2d57a

Browse files
authored
Merge pull request #95 from TrueNine/dev
Fix WSL mirror sync lint regression
2 parents f8a15ab + 90a8ea0 commit 3b2d57a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cli/src/wsl-mirror-sync.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import type {
66
PluginOptions,
77
WslMirrorFileDeclaration
88
} from './plugins/plugin-core'
9-
import {Buffer} from 'node:buffer'
109
import type {RuntimeEnvironmentContext} from './runtime-environment'
10+
import {Buffer} from 'node:buffer'
1111
import {spawnSync} from 'node:child_process'
1212
import * as fs from 'node:fs'
1313
import * as path from 'node:path'
@@ -137,8 +137,8 @@ function decodeWslCliOutput(
137137
if (typeof value === 'string') return value
138138
if (!Buffer.isBuffer(value) || value.length === 0) return ''
139139

140-
const hasUtf16LeBom = value.length >= 2 && value[0] === 0xff && value[1] === 0xfe
141-
const hasUtf16BeBom = value.length >= 2 && value[0] === 0xfe && value[1] === 0xff
140+
const hasUtf16LeBom = value.length >= 2 && value[0] === 0xFF && value[1] === 0xFE
141+
const hasUtf16BeBom = value.length >= 2 && value[0] === 0xFE && value[1] === 0xFF
142142
if (hasUtf16LeBom || hasUtf16BeBom) return value.toString('utf16le').replace(/^\uFEFF/u, '')
143143

144144
const utf8Text = value.toString('utf8')
@@ -308,7 +308,7 @@ function resolveGeneratedWslMirrorSource(
308308

309309
// Mirror home-style tool config roots only. Windows app-data trees such as
310310
// AppData\Local\JetBrains\... stay Windows-only even though they live under the user profile.
311-
if (topLevelSegment == null || !topLevelSegment.startsWith('.')) return void 0
311+
if (!topLevelSegment?.startsWith('.')) return void 0
312312

313313
return {
314314
kind: 'generated',
@@ -614,9 +614,10 @@ export async function syncWindowsConfigIntoWsl(
614614
continue
615615
}
616616

617+
const {relativePathSegments, sourcePath} = declaration
618+
617619
for (const resolvedTarget of resolvedTargets) {
618-
const sourcePath = declaration.sourcePath
619-
const targetPath = path.win32.join(resolvedTarget.windowsHomeDir, ...declaration.relativePathSegments)
620+
const targetPath = path.win32.join(resolvedTarget.windowsHomeDir, ...relativePathSegments)
620621

621622
try {
622623
if (ctx.dryRun === true) {

0 commit comments

Comments
 (0)