File names are broken on macOS scripts
Bug reproduction:
#target illustrator
var file = File.openDialog("Select any file", "All files:*.*");
var message = 'Results\nfile.name: "' + file.name + '"\nfile.displayName: "' + file.displayName + '"\nfile.localizedName: "' + file.localizedName + '"';
alert(message);
Save this as a script, run it in Illustrator on macOS and select any file.
Expected outcome: An alert is displayed with all of the name attributes are populated
Actual outcome: displayName and localizedName give empty string and undefined.
Tested on macOS 15.7.1, Illustrator v29.8.2. Same script works on Windows 11.

-
kulmajaba commented
I referenced docsforadobe (specifically https://extendscript.docsforadobe.dev/file-system-access/file-object/) which is a community project so that part is probably outdated. It's hard to find up to date official reference for the scripting API.
-
Sergey Osokin commented
I confirm the displayName issue. The InDesign community complained about this and it seems to have been fixed for InDesign. Adobe Illustrator CC 2025 on Mac OS has a similar problem.. But where did you get the localizedName from? It's not in the Illustrator Scripting API.
Alternative solution: decodeURI(file.name ) instead of file.DisplayName