Skip to content

Commit 7f0a5cf

Browse files
committed
fix: fixed creating cache directory
1 parent 55ce8ee commit 7f0a5cf

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: src/config/ConfigLoader.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,21 @@ class ConfigLoader extends EventEmitter {
5757
}
5858

5959
async initialize() {
60-
// Initialize cache directory using env-paths
61-
const paths = envPaths('git-proxy', { suffix: '' });
60+
// Get cache directory path
61+
const paths = envPaths('git-proxy');
6262
this.cacheDir = paths.cache;
63+
64+
// Create cache directory if it doesn't exist
65+
if (!fs.existsSync(this.cacheDir)) {
66+
try {
67+
fs.mkdirSync(this.cacheDir, { recursive: true });
68+
return true;
69+
} catch (err) {
70+
console.error('Failed to create cache directory:', err);
71+
return false;
72+
}
73+
}
74+
return true;
6375
}
6476

6577
async start() {

0 commit comments

Comments
 (0)