File paths are being mangled
g5becks opened this issue · 0 comments
g5becks commented
I have a default path being stored that usings path.join to create the path, when getting the path back from the config, it is not formatted correctly. E.G.
export type Config = {
dataPath: string
campaignsDB: string
port: number
}
const dataPath = getDataDir() // this gives a real path like - 'home/becks/Dev/app/packages/server/data'
const campaignsDB = path.join(dataPath, 'db', 'campaigns.csv')
const conf = new Conf<Config>({
defaults: {
dataPath,
campaignsDB,
port: 3000,
},
configName: 'alis',
})
export const getCampaignsDB = (): string => conf.get('campaignsDB')
console.log(campaignsDB) == 'home/becks/Dev/app/packages/server/data/db/campaigns.csv'
console.log(getCampaignsDB()) == 'home/becks/Dev/app/packages/server/datadb/campaigns.csv' // notice the missing slash !
I'm not sure how or why this is happening, but it took me a good 20 minutes to realize that it was this lib causing the issue. Any ideas on what it might be?
Thanks.