Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
verytactical committed Jan 22, 2025
1 parent c184793 commit 5ce3afc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/cli/tact/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync } from "fs";
import { basename, dirname, join, resolve } from "path";
import { basename, dirname, join, normalize, resolve } from "path";
import { execFileSync } from "child_process";
import { z, ZodError } from "zod";
import { createNodeFileSystem } from "../../vfs/createNodeFileSystem";
Expand Down Expand Up @@ -115,14 +115,21 @@ const parseArgs = async (Errors: CliErrors, Args: Args) => {

const configPath = Args.single("config");
if (configPath) {
const normalizedPath = resolve(cwd(), dirname(configPath));
const Fs = createNodeFileSystem(normalizedPath, false);
if (!Fs.exists(configPath)) {
const normalizedConfigPath = normalize(resolve(cwd(), configPath));
const normalizedDirPath = normalize(
resolve(cwd(), dirname(configPath)),
);
const Fs = createNodeFileSystem(normalizedDirPath, false);
if (!Fs.exists(normalizedConfigPath)) {
Errors.configNotFound(configPath);
return;
}
const configText = Fs.readFile(configPath).toString("utf-8");
const config = parseConfigSafe(Errors, configPath, configText);
const configText = Fs.readFile(normalizedConfigPath).toString("utf-8");
const config = parseConfigSafe(
Errors,
normalizedConfigPath,
configText,
);
if (!config) {
return;
}
Expand Down

0 comments on commit 5ce3afc

Please sign in to comment.