Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File paths are being mangled #129

Open
g5becks opened this issue Oct 1, 2020 · 0 comments
Open

File paths are being mangled #129

g5becks opened this issue Oct 1, 2020 · 0 comments

Comments

@g5becks
Copy link

g5becks commented Oct 1, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant