Showing the changes to apps/server/src/sourceControl/SourceControlRepositoryService.ts (1 of 103 files). Show all
Unified · Split
| @@ -1,4 +1,3 @@ | ||
| 1 | −import * as NodeOS from "node:os"; | |
| 2 | 1 | import * as Context from "effect/Context"; |
| 3 | 2 | import * as Effect from "effect/Effect"; |
| 4 | 3 | import * as FileSystem from "effect/FileSystem"; |
| @@ -20,6 +19,7 @@ import { · 15 unmodified lines | ||
| 20 | 19 | } from "@t3tools/contracts"; |
| 21 | 20 | |
| 22 | 21 | import { ServerConfig } from "../config.ts"; |
| 22 | +import { expandHomePathWith } from "../pathExpansion.ts"; | |
| 23 | 23 | import * as GitVcsDriver from "../vcs/GitVcsDriver.ts"; |
| 24 | 24 | import * as SourceControlProviderRegistry from "./SourceControlProviderRegistry.ts"; |
| 25 | 25 | const isSourceControlRepositoryError = Schema.is(SourceControlRepositoryError); |
| @@ -77,16 +77,6 @@ function selectRemoteUrl( · 51 unmodified lines | ||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | −function expandHomePath(input: string, path: Path.Path): string { | |
| 81 | − if (input === "~") { | |
| 82 | − return NodeOS.homedir(); | |
| 83 | − } | |
| 84 | − if (input.startsWith("~/") || input.startsWith("~\\")) { | |
| 85 | − return path.join(NodeOS.homedir(), input.slice(2)); | |
| 86 | − } | |
| 87 | − return input; | |
| 88 | −} | |
| 89 | − | |
| 90 | 80 | export const make = Effect.gen(function* () { |
| 91 | 81 | const config = yield* ServerConfig; |
| 92 | 82 | const fileSystem = yield* FileSystem.FileSystem; |
| @@ -137,7 +127,7 @@ export const make = Effect.gen(function* () { · 44 unmodified lines | ||
| 137 | 127 | }); |
| 138 | 128 | } |
| 139 | 129 | |
| 140 | − return path.resolve(expandHomePath(trimmed, path)); | |
| 130 | + return path.resolve(expandHomePathWith(trimmed, path)); | |
| 141 | 131 | }, |
| 142 | 132 | ); |
| 143 | 133 | |