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
23 changes: 12 additions & 11 deletions src/lib/mujoco-asset-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@ function normalizeZipPath(path: string): string {

function buildZipCandidates(assetPath: string): string[] {
const normalized = normalizeZipPath(assetPath);
const withoutUnderscorePrefix = normalized.startsWith("mujoco_assets/")
? normalized.slice("mujoco_assets/".length)
: normalized;
const withoutHyphenPrefix = normalized.startsWith("mujoco-assets/")
? normalized.slice("mujoco-assets/".length)
: normalized;
const candidates = new Set<string>();
// Strip whichever known prefix is present to get a prefix-agnostic stem,
// so both prefix flavors resolve to the same candidate set.
let stem = normalized;
if (stem.startsWith("mujoco-assets/")) {
stem = stem.slice("mujoco-assets/".length);
} else if (stem.startsWith("mujoco_assets/")) {
stem = stem.slice("mujoco_assets/".length);
}

const candidates = new Set<string>();
candidates.add(normalized);
candidates.add(withoutUnderscorePrefix);
candidates.add(withoutHyphenPrefix);
candidates.add(`mujoco-assets/${withoutUnderscorePrefix}`);
candidates.add(`mujoco_assets/${withoutUnderscorePrefix}`);
candidates.add(stem);
candidates.add(`mujoco-assets/${stem}`);
candidates.add(`mujoco_assets/${stem}`);

return Array.from(candidates).filter(Boolean);
}
Expand Down