From 310e31becab4d4c6d11c428cc9eca26f6cd22350 Mon Sep 17 00:00:00 2001 From: Julien Barbay Date: Thu, 14 Sep 2023 09:37:08 +0700 Subject: [PATCH] fix: dont use __dirname --- index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index a3874b75..968bff47 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,6 @@ import fs = require('fs') import path = require('path') +import url = require('url') import utils = require('./utils') const params = require('./params') as { "LOCATION_RECORD_SIZE": number, @@ -9,7 +10,10 @@ const params = require('./params') as { var cacheEnabled = false; const ipCache:{[filename:string]:ipBlockRecord[]|indexFile} = {} var locationCache:Promise; -const DATA_DIR = path.join(path.dirname(__dirname), "data"); +const DATA_DIR = path.join( + path.dirname(url.fileURLToPath(import.meta.url)), + 'data' +) function enableCache(){ if(!cacheEnabled){