From 068535b8ef2c132a8a19d1fb9c2e37b9ead028d7 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 30 Aug 2026 21:54:13 -0700 Subject: [PATCH] fix(main): isolate runtime file path naming --- .../runtime-file-commands-constructor.ts | 2 +- .../runtime/runtime-file-commands-host.ts | 22 +++++++++++++++---- ...me-file-commands-mobile-file-list-limit.ts | 2 +- src/main/runtime/runtime-file-path-names.ts | 5 +++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 src/main/runtime/runtime-file-path-names.ts diff --git a/src/main/runtime/runtime-file-commands-constructor.ts b/src/main/runtime/runtime-file-commands-constructor.ts index bd72ee51895..a2f313db138 100644 --- a/src/main/runtime/runtime-file-commands-constructor.ts +++ b/src/main/runtime/runtime-file-commands-constructor.ts @@ -5,11 +5,11 @@ import { } from './runtime-file-commands-active-runtime-text-searches' import type { RuntimeFileCommandHost } from './runtime-file-commands-host' import { - basenameFromRelativePath, isMobileBinaryPath, isMobileMarkdownPath, isSafeMobileRelativePath } from './runtime-file-commands-host' +import { basenameFromRelativePath } from './runtime-file-path-names' import type { RuntimeFileListResult, RuntimeFileOpenResult } from '../../shared/runtime-types' import { listQuickOpenFiles } from '../ipc/filesystem-list-files' import { diff --git a/src/main/runtime/runtime-file-commands-host.ts b/src/main/runtime/runtime-file-commands-host.ts index f85cf4bfe38..5a8528e639b 100644 --- a/src/main/runtime/runtime-file-commands-host.ts +++ b/src/main/runtime/runtime-file-commands-host.ts @@ -15,6 +15,8 @@ import { } from './runtime-file-commands-mobile-file-list-limit' import { watch as watchFs } from 'node:fs' import { WatcherProcessFailure } from '../ipc/parcel-watcher-process-failure' +import { basenameFromRelativePath } from './runtime-file-path-names' +import { basenameFromRelativePath } from './runtime-file-path-names' export type RuntimeFileCommandHost = { getRuntimeId(): string @@ -167,15 +169,27 @@ export function isMobileBinaryPath(relativePath: string): boolean { return MOBILE_BINARY_EXTENSIONS.has(basename.slice(dotIndex).toLowerCase()) } +<<<<<<< HEAD +export function isRuntimeDirectoryEntry(entry: { + isDirectory(): boolean + isSymbolicLink(): boolean +}): boolean { +||||||| parent of eb63e7e8479 (fix(main): isolate runtime file path naming) export function basenameFromRelativePath(relativePath: string): string { const normalized = relativePath.replace(/\\/g, '/') return normalized.slice(normalized.lastIndexOf('/') + 1) } -export function isRuntimeDirectoryEntry(entry: { - isDirectory(): boolean - isSymbolicLink(): boolean -}): boolean { +export async function isRuntimeDirectoryEntry( + entry: { isDirectory(): boolean; isSymbolicLink(): boolean }, + _entryPath: string +): Promise { +======= +export async function isRuntimeDirectoryEntry( + entry: { isDirectory(): boolean; isSymbolicLink(): boolean }, + _entryPath: string +): Promise { +>>>>>>> eb63e7e8479 (fix(main): isolate runtime file path naming) // Why: listings are passive UI reads; don't stat symlink targets here (explicit open/expand resolves them). if (entry.isSymbolicLink()) { return false diff --git a/src/main/runtime/runtime-file-commands-mobile-file-list-limit.ts b/src/main/runtime/runtime-file-commands-mobile-file-list-limit.ts index 12e50a560de..66d8ca1bc9f 100644 --- a/src/main/runtime/runtime-file-commands-mobile-file-list-limit.ts +++ b/src/main/runtime/runtime-file-commands-mobile-file-list-limit.ts @@ -9,7 +9,7 @@ import { import { constants } from 'node:fs/promises' import { toSshExecutionHostId } from '../../shared/execution-host' import { assertSshMutationExpectation } from '../ssh/ssh-connection-generation' -import { basenameFromRelativePath } from './runtime-file-commands-host' +import { basenameFromRelativePath } from './runtime-file-path-names' import { normalizeRuntimePathForComparison } from '../../shared/cross-platform-path' export const MOBILE_FILE_LIST_LIMIT = 5000 diff --git a/src/main/runtime/runtime-file-path-names.ts b/src/main/runtime/runtime-file-path-names.ts new file mode 100644 index 00000000000..b8a2b29abd0 --- /dev/null +++ b/src/main/runtime/runtime-file-path-names.ts @@ -0,0 +1,5 @@ +/** Returns the final path component without assuming a host path separator. */ +export function basenameFromRelativePath(relativePath: string): string { + const normalized = relativePath.replace(/\\/g, '/') + return normalized.slice(normalized.lastIndexOf('/') + 1) +}