@tmustier/pi-nes 0.2.20 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/nes/index.ts +8 -6
- package/package.json +1 -1
package/extensions/nes/index.ts
CHANGED
|
@@ -43,15 +43,17 @@ async function selectRom(
|
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
roms.map((rom) => rom.name),
|
|
49
|
-
);
|
|
46
|
+
const options = roms.map((rom, index) => `${index + 1}. ${rom.name}`);
|
|
47
|
+
const selection = await ctx.ui.select("Select a ROM", options);
|
|
50
48
|
if (!selection) {
|
|
51
49
|
return null;
|
|
52
50
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
51
|
+
const index = options.indexOf(selection);
|
|
52
|
+
if (index < 0) {
|
|
53
|
+
ctx.ui.notify("ROM selection failed. Please try again.", "error");
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return roms[index]?.path ?? null;
|
|
55
57
|
} catch {
|
|
56
58
|
ctx.ui.notify(`Failed to read ROM directory: ${romDir}. Update ${configPath} to set romDir.`, "error");
|
|
57
59
|
return null;
|