Skip to content

Commit e4d83e7

Browse files
committed
Fix isLocalFolder() to allow symlinks to directories
I'm trying to layer in a local feature for my developers to apply custom preferences to their devcontainers without polluting eachother's devcontainers. I want to use a symlink from `~/.devcontainer/personal-config` to the local repository's `.devcontainer/personal-config` and add: ``` { ... "features": { "./personal-config": {} } } ``` To the local repository's `.devcontainer/devcontainer.json`. Unfortunately, the current `isLocalFolder()` chokes on symlinks. This patch should allow symlinked directories for local features. I'm not a TypeScript programmer, and I'm not sure this is the exact implementation. I'm not a fan of async programming, especially for command line utilities with linear workflows, but the world lost it's mind and uses callback non-sense for straight forward problems, so here we are.
1 parent f4ee5d0 commit e4d83e7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/spec-utils/pfs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function isLocalFile(filepath: string): Promise<boolean> {
1515
}
1616

1717
export function isLocalFolder(filepath: string): Promise<boolean> {
18-
return new Promise(r => fs.stat(filepath, (err, stat) => r(!err && stat.isDirectory())));
18+
return new Promise(r => fs.realpath(filepath, (err,rpath) => r(!err && fs.stat(rpath, (err, stat) => r(!err && stat.isDirectory())))));
1919
}
2020

2121
export const readLocalFile = promisify(fs.readFile);

0 commit comments

Comments
 (0)