Your question is Trivial Directory Path Function. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
OpenAI Codex may receive a current workspace directory and a user-provided location. Implement a function that resolves the location into a normalized absolute POSIX path without accessing the filesystem.
If new_location is absolute, resolve it from the root and ignore current_dir. Otherwise, resolve it relative to current_dir. A . component has no effect, and a .. component moves to the parent directory. Attempts to move above / remain at /. Collapse repeated separators and remove trailing separators except for the root path.
Given two non-empty strings, current_dir and new_location, return a string containing the normalized absolute path. current_dir is always absolute and uses / as the separator. Both paths contain only POSIX-style components, /, ., and ...
current_dir is an absolute POSIX path.new_location is non-empty./.def resolve_path(current_dir, new_location):