Allow to read file with same name after changing current working directory
pvdlg opened this issue · 0 comments
pvdlg commented
Currently it seems rc
caches the file content by name rather than using the full path of the file.
That create a situation in which a given filename won't be loaded if the same filename was loaded from another directory before.
Here is the steps to reproduce:
// File `/directory_1/myapprc`
property = 1
// File `/directory_2/myapprc`
property = 2
process.chdir('/directory_1');
var conf1 = require('rc')('myapprc');
console.log(conf1.property);
// 1
process.chdir('/directory_2');
var conf2 = require('rc')('myapprc');
console.log(conf2.property);
// 1 => should be 2