only consider workspaces containing an env directory

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-05-21 16:18:47 -07:00
parent f374f4c5ea
commit 0acd3a256a

View File

@ -40,6 +40,9 @@ func Init(ctx context.Context, dir string) (*Workspace, error) {
} }
return nil, err return nil, err
} }
if err := os.Mkdir(path.Join(root, envDir), 0755); err != nil {
return nil, err
}
return &Workspace{ return &Workspace{
Path: root, Path: root,
}, nil }, nil
@ -72,7 +75,7 @@ func Current(ctx context.Context) (*Workspace, error) {
// Walk every parent directory to find .dagger // Walk every parent directory to find .dagger
for { for {
_, err := os.Stat(path.Join(current, daggerDir)) _, err := os.Stat(path.Join(current, daggerDir, envDir))
if err == nil { if err == nil {
return Open(ctx, current) return Open(ctx, current)
} }