fix paths
This commit is contained in:
parent
79f0f5deba
commit
7a2e2ada4c
@ -4,7 +4,17 @@ import path from "path";
|
||||
import { ScriptSchema, type Script } from "@/app/json-editor/_schemas/schemas";
|
||||
import { Metadata } from "@/lib/types";
|
||||
|
||||
const jsonDir = path.join(__dirname, '../../json');
|
||||
const publicJsonPath = path.join(process.cwd(), 'public/json');
|
||||
const getJsonDirectory = async () => {
|
||||
if (!(await fs.stat(publicJsonPath).catch(() => null))) {
|
||||
throw new Error(`JSON path file not found: ${publicJsonPath}`);
|
||||
}
|
||||
const jsonPath = (await fs.readFile(publicJsonPath, "utf-8")).trim();
|
||||
return path.resolve(process.cwd(), jsonPath);
|
||||
};
|
||||
|
||||
|
||||
const jsonDir = await getJsonDirectory();
|
||||
const metadataFileName = "metadata.json";
|
||||
const encoding = "utf-8";
|
||||
|
||||
|
@ -5,7 +5,16 @@ import path from "path";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
const jsonDir = path.join(__dirname, '../../json');
|
||||
const publicJsonPath = path.join(process.cwd(), 'public/json');
|
||||
const getJsonDirectory = async () => {
|
||||
if (!(await fs.stat(publicJsonPath).catch(() => null))) {
|
||||
throw new Error(`JSON path file not found: ${publicJsonPath}`);
|
||||
}
|
||||
const jsonPath = (await fs.readFile(publicJsonPath, "utf-8")).trim();
|
||||
return path.resolve(process.cwd(), jsonPath);
|
||||
};
|
||||
|
||||
const jsonDir = await getJsonDirectory();
|
||||
const metadataFileName = "metadata.json";
|
||||
const encoding = "utf-8";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user