Extract function: canonical_path().