Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/config-yaml/src/registryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ export class RegistryClient implements Registry {
return fs.readFileSync(new URL(filepath), "utf8");
} else if (path.isAbsolute(filepath)) {
return fs.readFileSync(filepath, "utf8");
} else if (this.rootPath) {
return fs.readFileSync(path.join(this.rootPath, filepath), "utf8");
} else {
// Try to resolve relative to current working directory first
const resolvedPath = path.resolve(filepath);
if (fs.existsSync(resolvedPath)) {
return fs.readFileSync(resolvedPath, "utf8");
}
// Fall back to rootPath if file doesn't exist relative to cwd
if (this.rootPath) {
return fs.readFileSync(path.join(this.rootPath, filepath), "utf8");
}
throw new Error("No rootPath provided for relative file path");
}
}
Expand Down
Loading