import fs from "fs" ; import os from "os" ; import path from "path" ; const isHeadless = ! process . env . FORK ; export const rootPath = isHeadless ? process . env . NODE_PATH || __dirname : __dirname ; export let thoriumPath = path . join ( process . cwd ( ) , "data" ) ; if ( process . env . NODE_ENV === "production" ) { if ( ! fs . existsSync ( `${ os . homedir ( ) }/Documents` ) ) { fs . mkdirSync ( `${ os . homedir ( ) }/Documents` , { recursive : true } ) ; } thoriumPath = path . join ( os . homedir ( ) , `/Documents/thorium-nova` ) ; } if ( process . env . THORIUM_PATH ) { const testPath = String ( process . env . THORIUM_PATH ) . replace ( "~" , os . homedir ( ) ) ; try { fs . mkdirSync ( testPath , { recursive : true } ) ; thoriumPath = testPath ; } catch { } } thoriumPath = thoriumPath . replaceAll ( "\\" , "/" ) ; export const databaseName = process . env . NODE_ENV === "production" ? "db.yml" : process . env . NODE_ENV === "test" ? "db-test.yml" : "db-dev.yml" ;