fix(main): isolate runtime file path naming

This commit is contained in:
Neil
2026-08-31 02:49:23 -07:00
parent 3f65a96c1c
commit 649f38dc48
4 changed files with 25 additions and 6 deletions
@@ -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 {
+18 -4
View File
@@ -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<boolean> {
=======
export async function isRuntimeDirectoryEntry(
entry: { isDirectory(): boolean; isSymbolicLink(): boolean },
_entryPath: string
): Promise<boolean> {
>>>>>>> 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
@@ -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
@@ -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)
}