From 01a4022b9da4eae12861f6dab5f082a2323b419f Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Thu, 23 Oct 2025 18:10:31 +0200 Subject: [PATCH] fixed file path --- index.ts | 20 ++++++++++++++++---- package.json | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/index.ts b/index.ts index bf63488..93e68ef 100755 --- a/index.ts +++ b/index.ts @@ -1,5 +1,7 @@ #!/usr/bin/env bun +import path from "path"; + const STATE_FILE = "/tmp/csharpierd-state.json"; const LOCK_FILE = "/tmp/csharpierd.lock"; const SERVER_PORT = 18912; @@ -205,7 +207,7 @@ async function formatCode( "Content-Type": "application/json", }, body: JSON.stringify({ - fileName: `/tmp/${fileName}`, + fileName: path.join(process.cwd(), fileName), fileContents, }), }); @@ -297,7 +299,9 @@ async function showStatus(): Promise { if (!state) { console.log(colorize("Status:", "cyan"), colorize("NOT RUNNING", "red")); console.log("\nNo server is currently active."); - console.log("The server will start automatically on the first format request."); + console.log( + "The server will start automatically on the first format request.", + ); return; } @@ -329,9 +333,17 @@ async function showStatus(): Promise { const timeoutMinutes = IDLE_TIMEOUT_MS / 1000 / 60; if (idleMinutes >= timeoutMinutes) { - console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "red"), "(will shutdown)"); + console.log( + colorize("Idle Time:", "cyan"), + colorize(idleTimeStr, "red"), + "(will shutdown)", + ); } else if (idleMinutes >= timeoutMinutes * 0.75) { - console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "yellow"), `(${timeoutMinutes - idleMinutes}m until timeout)`); + console.log( + colorize("Idle Time:", "cyan"), + colorize(idleTimeStr, "yellow"), + `(${timeoutMinutes - idleMinutes}m until timeout)`, + ); } else { console.log(colorize("Idle Time:", "cyan"), colorize(idleTimeStr, "green")); } diff --git a/package.json b/package.json index ad7644d..d635ed9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "csharpierd", - "version": "1.0.0", + "version": "1.0.1", "description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout", "module": "index.ts", "type": "module",