mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Don't use custom dirname implementation
This commit is contained in:
1 file changed
+1
-14
@@ -1,22 +1,9 @@
|
||||
import { join } from "@std/path";
|
||||
import { join, dirname } from "@std/path";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { Tool, CallToolResult } from "./Tool";
|
||||
import type { JSRuntimeFS } from "../JSRuntime";
|
||||
|
||||
// Simple dirname implementation that works in browser environments
|
||||
function dirname(path: string): string {
|
||||
if (path === '' || path === '.') return '.';
|
||||
|
||||
// Handle Windows and Unix paths
|
||||
const lastSlash = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
|
||||
|
||||
if (lastSlash === -1) return '.';
|
||||
if (lastSlash === 0) return '/';
|
||||
|
||||
return path.slice(0, lastSlash);
|
||||
}
|
||||
|
||||
interface TextEditorWriteParams {
|
||||
path: string;
|
||||
file_text: string;
|
||||
|
||||
Reference in new issue
Block a user