mirror of
https://github.com/openai/codex.git
synced 2026-10-31 19:28:49 +00:00
codex: avoid cwd lookup for absolute paths
This commit is contained in:
@@ -63,7 +63,12 @@ impl AbsolutePathBuf {
|
||||
/// Construct an absolute path from `path`, resolving relative paths against
|
||||
/// the process current working directory.
|
||||
pub fn relative_to_current_dir<P: AsRef<Path>>(path: P) -> std::io::Result<Self> {
|
||||
Self::resolve_path_against_base(path, std::env::current_dir()?)
|
||||
let path = path.as_ref();
|
||||
if path.is_absolute() {
|
||||
Self::from_absolute_path(path)
|
||||
} else {
|
||||
Self::resolve_path_against_base(path, std::env::current_dir()?)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn join<P: AsRef<Path>>(&self, path: P) -> std::io::Result<Self> {
|
||||
|
||||
Reference in New Issue
Block a user