hello all, I also have the problem where Near Infinity can’t read `~/Documents` and can’t parse `Baldur.lua` or process save games.
macOS: Montery v12..5.1
Near Infinity: v.2.2-20220408-1
I think the problem might be that macOS protects the `~/Documents` folder in some weird way and apps need to request access to it. For example there’s an entry for Steam under `System Preferences > Security and Privacy > Privacy > Files and Folders` that explicitly grants Steam access to the `Documents Folder`.
The access permission handling on macOS is done on a system level (just like UAC on Windows). I don't think there is anything I can do coding-wise in NI.
Afaik, when an app attempts to access a protected folder, there should open a popup dialog where you can allow or deny access. I don't have access to a macOS system though, so I can't check whether that behavior has changed in more recent versions.
Can you manually add entries to the access permission settings? You could try to add the java binary to the list.
That panel of System Preferences has a + button, yes. Which is greyed out for me, even when I unlock the thing to try to make changes. And I haven't seen any popups like that.
Also BGEE has an entry for allowing "Documents" while BG2EE doesn't ... but both of them can find and work with their saves just fine.
It looks like it’s not possible to manually add apps to the `Files and Folders` list but it’s possible to add them to the `Full Disk Access` list in the same System Preferences panel. I added Near Infinity and the Java binary (`/usr/bin/java`) to that list and they also appear under `Files and Folders` but that didn’t help. The error still occurs.
@jmerry@nclbch Can you access the game's home folder through another path? If that's the case, then I can probably add an option for custom home folders to NI.
Make aliases for the home folders, move to somewhere NI can see... the alias is interpreted as a file. Can't reach the contents of the folder if you don't see it as a folder. And of course, there's no other path to them that doesn't pass through "Documents".
That's not specific to aliases for subfolders of "Documents"; any alias I make for a folder gets interpreted as a file by the "Open" dialog box.
Yeah, I have looked it up again. There is no way to access files or folders through aliases without platform-specific coding (which is not really feasible for NI).
The most common solution I could find is replacing the alias by a soft link (symbolic link), which should be properly detected by NI. The general syntax to create one is
ln -sv /path/to/original /path/to/link
using the terminal. You should be able to get the original path in the Finder: Select the alias and choose "Get Info" from the context menu.
And be sure to escape certain characters in the path - the original path to the game's home folder ends in something like "Baldur's Gate - Enhanced Edition", after all. That needs six backslashes to be interpreted properly.
With that caveat, I created the soft link. NI sees it as a folder. And still can't see the contents.
... All right, what does it mean if this can't be fixed? I have to endure an error message every time I open NI or a game's profile, and I can't edit saves "live". In order to edit a save, I have to copy it to somewhere NI can see, open it through the "Open File" dialogue, and then move the edited file back once I'm done. Very inconvenient, but not fatal.
And be sure to escape certain characters in the path - the original path to the game's home folder ends in something like "Baldur's Gate - Enhanced Edition", after all. That needs six backslashes to be interpreted properly.
With that caveat, I created the soft link. NI sees it as a folder. And still can't see the contents.
... All right, what does it mean if this can't be fixed? I have to endure an error message every time I open NI or a game's profile, and I can't edit saves "live". In order to edit a save, I have to copy it to somewhere NI can see, open it through the "Open File" dialogue, and then move the edited file back once I'm done. Very inconvenient, but not fatal.
It can be worked around. But, you have to flip @Argent77's symlink idea. The real folder with the BALDUR.LUA file and save games needs to be outside the Documents folder. The symlink goes in the Documents folder.
First, move the "Baldur's Gate - Enhanced Edition" folder to be in the same folder as the game folder, but not *in* the game folder (e.g., I installed the games via the Beamdog app. This installs the game folders in individual folders under a folder called "Beamdog Library", so I moved the "Baldur's Gate - Enhanced Edition" folder from Documents to "Beamdog Library".) NearInfinity can see BALDUR.LUA here, as well as the portrait and save folders. Then, create a symbolic link to the "Baldur's Gate - Enhanced Edition" folder in the Documents folder. An alias created with Finder won't work. It has to be a symlink created with Terminal.
Obviously substitute in the location of your folder for "Beamdog Library" on Steam/GOG installs. This is will allow BGEE to see the save game location in its new place as if it were in the Documents folder.
Implemented, though I put the new version of the game's home folder under ~. It just makes more sense to me to have that in the user folder than in a neutral location like Applications.
And together with the NI update that allows bookmarks to set a path for the home folder rather than always using the default, it's a fully functional workaround. (That update isn't public at this time; I got a testing version via a message here)
NI sees that folder through its true path, while the game does through the symlink in Documents. Lots of setup, but now NI can see new saves with no extra steps beyond maybe refreshing the tree.
Added new option to Bookmark feature: Define custom home folder for EE games (primarily added as a workaround for systems with inaccessible folders for Java apps, e.g. macOS with iCloud folders).
Added new "Align table (uniform)" command to 2DA resources which mimics WeiDU's PRETTY_PRINT_2DA-style formatting. Original "Align table" command renamed to "Align table (compact)".
Added support for more hardcoded save folders in EE games (ImportSave and ImportBPSave).
Added new feature: Check for duplicate strings.
Fixed a bug in the 2DA table parse which prevented the SoD-specific save folder from showing up in the resource tree.
Fixed value type "Bitfield" in Advanced Search filter options to match all numeric data in structured resources.
Fixed BAM frames export not always appending the correct file extension.
Fixed transparent color index handling in BAM Converter (thanks Bubb).
Fixed a regression in rendering creature animations with tint effects.
Fixed incorrectly calculated marker of a selected area in WMP View tab.
Fixed PSTEE bestiary parsing issue in "Check for unused strings".
Fixed: Confirm overwriting animation file on export in Creature Animation Browser.
Improved function-matching algorithm in script decompiler, which (hopefully) solves incorrectly detected script action signatures under certain conditions.
Improved display of creature names in View tab for CRE, CHR and embedded CRE structures in GAM files.
Improved View tab layout of ARE, ITM and SPL resources for smaller window sizes.
Improved parser for TRIGGER.IDS and ACTION.IDS tables.
I have a new, improved macOS version of NearInfinity. It is a full Mac app, with a bundled JRE (so no need to install Java if you don't have it already), and it will ask for permission to read the Documents folder on first launch. So, no moving game home folders, no symlinks, no manual editing of the Security preferences. It lives in the Applications folder, gets added to Launchpad, uses the custom NearInfinity icon for the app and Dock. It is even installed via .pkg file.
I have a new, improved macOS version of NearInfinity. It is a full Mac app, with a bundled JRE (so no need to install Java if you don't have it already), and it will ask for permission to read the Documents folder on first launch. So, no moving game home folders, no symlinks, no manual editing of the Security preferences. It lives in the Applications folder, gets added to Launchpad, uses the custom NearInfinity icon for the app and Dock. It is even installed via .pkg file.
And actually, it's the .pkg file that needs the security bypass to run. NI itself was fine automatically - it seems the installer gave it the permission needed?
Just a side note: you need to download the ".pkg" file, not the ".dmg" one (when I downloaded the ".dmg" file and moved the app in "/Applications", I kept getting the following error => "The app is damaged and cannot be opened")
Just a side note: you need to download the ".pkg" file, not the ".dmg" one (when I downloaded the ".dmg" file and moved the app in "/Applications", I kept getting the following error => "The app is damaged and cannot be opened")
I’ll look into that. It worked fine in my tests, but that doesn’t mean there isn’t an issue. If the pkg format works, Stick with that.
And actually, it's the .pkg file that needs the security bypass to run. NI itself was fine automatically - it seems the installer gave it the permission needed?
Good to know. I've updated the installation info on the GitHub release.
I spoke too soon. I've been making excuses, or thinking this was something else, but ... ever since I installed that latest (Mac) version, changes to bookmarks are ephemeral. I can bookmark a game, or alter existing bookmarks, and it all works great - until I quit, and then the next time I open the program the bookmarks are back to where they were when I installed this version of NI. Which is functional for now, but not what I want long-term.
I spoke too soon. I've been making excuses, or thinking this was something else, but ... ever since I installed that latest (Mac) version, changes to bookmarks are ephemeral. I can bookmark a game, or alter existing bookmarks, and it all works great - until I quit, and then the next time I open the program the bookmarks are back to where they were when I installed this version of NI. Which is functional for now, but not what I want long-term.
Closing NI correctly is somewhat complicated on macOS because of the special way how the system handles closing applications in general.
There is a Quit command in the "NearInfinity" menu which is automatically created by the system. There is also the Command+Q shortcut to close NI which is also overridden by the system. Both options are currently not properly handled by NI, so any options that were changed by the user are not saved.
I haven't found a feasible way to fix this issue yet, since it requires access to platform-specific code which is not available on other systems.
To ensure that options, bookmarks, and other changes are saved you have to explicitly quit the app from the "Game" menu.
@argent77, @jmerry - This is odd. NI works fine for me. It saves my bookmarks and user state, even if I exit with the Quit command in the NearInfinity menu or Command-Q.
It sounds like macOS is running NI translocated for @jmerry. Where is NI installed? This article suggests that moving the app to another location can stop the translocation.
Another possibility would be to use xattr to remove the quantine flags altogether.
Open a Terminal in the folder with NI. Enter the following command:
I suspect that the problem is related to the Java Runtime version installed on the system. Up to Java 8 there is a way, coding-wise, to properly handle Command-Q (and possibly the Quit command from the NearInfinity menu as well). Java 9 and higher versions require a different approach which is not possible to implement unless I ramp up the minimum requirements for NI.
On my macOS test VM is Java 17 installed, and I have experienced the same issue as @jmerry .
I suspect that the problem is related to the Java Runtime version installed on the system. Up to Java 8 there is a way, coding-wise, to properly handle Command-Q (and possibly the Quit command from the NearInfinity menu as well). Java 9 and higher versions require a different approach which is not possible to implement unless I ramp up the minimum requirements for NI.
On my macOS test VM is Java 17 installed, and I have experienced the same issue as @jmerry .
Try this version. I was able to use jpackage from Java 17 but have it bundle the JRE from Java 8.
Works for me, too. The only issue now is that NI's system info shows information about the system version of Java rather than the bundled version from the pkg.
Works for me, too. The only issue now is that NI's system info shows information about the system version of Java rather than the bundled version from the pkg.
@Argent77 - What version are you seeing? This is what I see on boot up of NI, with the new build (using Java 8 JRE):
Works for me, too. The only issue now is that NI's system info shows information about the system version of Java rather than the bundled version from the pkg.
@Argent77 - What version are you seeing? This is what I see on boot up of NI, with the new build (using Java 8 JRE)
Nevermind, it works now. It was probably a side effect of not removing the old package before installing the new one.
Added check option for illegal soundrefs in strings.
Found under menu Tools > Check > For illegal SoundRefs in Strings.
Added option to override UI scaling.
Overrides the system's global scaling of UI elements by a specified scaling factor, which may be useful on high dpi screens with a global UI scaling factor to display graphics in their original size. Works well in combination with the "Change Global Font Size" option.
Requires Java 9 or higher to be effective.
Completely redesigned the effect opcode handling.
There may still be bugs found because of the huge amount of changes. Please report them if you encounter one.
Fixed and/or updated several opcode definitions in the process.
Improved Mass Exporter.
Added shortcut Ctrl+M.
Added more export options: Trim spaces (all text files), Align table columns (2DA): compact or uniform.
Improvements for the Bookmark feature.
A confirmation prompt is shown before opening a bookmarked game.
Added shortcuts for bookmarked games: Ctrl+Alt+[number] for the first 10 games, Ctrl+Alt+Shift+[number] for games 11 to 20.
Improved text resource features: Trim, Align, Sort.
Improved sorting feature for TRIGGER.IDS: Bit 0x4000 will not be considered by the sorting algorithm.
Comments
macOS: Montery v12..5.1
Near Infinity: v.2.2-20220408-1
I think the problem might be that macOS protects the `~/Documents` folder in some weird way and apps need to request access to it. For example there’s an entry for Steam under `System Preferences > Security and Privacy > Privacy > Files and Folders` that explicitly grants Steam access to the `Documents Folder`.
Afaik, when an app attempts to access a protected folder, there should open a popup dialog where you can allow or deny access. I don't have access to a macOS system though, so I can't check whether that behavior has changed in more recent versions.
Can you manually add entries to the access permission settings? You could try to add the java binary to the list.
Also BGEE has an entry for allowing "Documents" while BG2EE doesn't ... but both of them can find and work with their saves just fine.
This feels closer, but still not fully there...
That's not specific to aliases for subfolders of "Documents"; any alias I make for a folder gets interpreted as a file by the "Open" dialog box.
The most common solution I could find is replacing the alias by a soft link (symbolic link), which should be properly detected by NI. The general syntax to create one is using the terminal. You should be able to get the original path in the Finder: Select the alias and choose "Get Info" from the context menu.
With that caveat, I created the soft link. NI sees it as a folder. And still can't see the contents.
... All right, what does it mean if this can't be fixed? I have to endure an error message every time I open NI or a game's profile, and I can't edit saves "live". In order to edit a save, I have to copy it to somewhere NI can see, open it through the "Open File" dialogue, and then move the edited file back once I'm done. Very inconvenient, but not fatal.
It can be worked around. But, you have to flip @Argent77's symlink idea. The real folder with the BALDUR.LUA file and save games needs to be outside the Documents folder. The symlink goes in the Documents folder.
First, move the "Baldur's Gate - Enhanced Edition" folder to be in the same folder as the game folder, but not *in* the game folder (e.g., I installed the games via the Beamdog app. This installs the game folders in individual folders under a folder called "Beamdog Library", so I moved the "Baldur's Gate - Enhanced Edition" folder from Documents to "Beamdog Library".) NearInfinity can see BALDUR.LUA here, as well as the portrait and save folders. Then, create a symbolic link to the "Baldur's Gate - Enhanced Edition" folder in the Documents folder. An alias created with Finder won't work. It has to be a symlink created with Terminal.
Open a Terminal window. Run a command like this:
ln -s ~/Beamdog\ Library/Baldur\'s\ Gate\ -\ Enhanced\ Edition ~/Documents
Obviously substitute in the location of your folder for "Beamdog Library" on Steam/GOG installs. This is will allow BGEE to see the save game location in its new place as if it were in the Documents folder.
And together with the NI update that allows bookmarks to set a path for the home folder rather than always using the default, it's a fully functional workaround. (That update isn't public at this time; I got a testing version via a message here)
NI sees that folder through its true path, while the game does through the symlink in Documents. Lots of setup, but now NI can see new saves with no extra steps beyond maybe refreshing the tree.
Full Changelog:
FORGET THIS. Please see the post below.
I have a new, improved macOS version of NearInfinity. It is a full Mac app, with a bundled JRE (so no need to install Java if you don't have it already), and it will ask for permission to read the Documents folder on first launch. So, no moving game home folders, no symlinks, no manual editing of the Security preferences. It lives in the Applications folder, gets added to Launchpad, uses the custom NearInfinity icon for the app and Dock. It is even installed via .pkg file.
https://github.com/AstroBryGuy/NearInfinity-OSX/releases/tag/v2.3-20220906
It works great on my macOS test machine. I can't test the cloud-related issue on my end, but maybe @jmerry can provide more feedback.
@AstroBryGuy Btw, I have attached a .icns file for NI with a full icon set (512x512 down to 16x16 pixels), if you want to improve the app icon.
Thanks! I'll use that in the next version.
And actually, it's the .pkg file that needs the security bypass to run. NI itself was fine automatically - it seems the installer gave it the permission needed?
It is working fine for me too, thanks!
Just a side note: you need to download the ".pkg" file, not the ".dmg" one (when I downloaded the ".dmg" file and moved the app in "/Applications", I kept getting the following error => "The app is damaged and cannot be opened")
I’ll look into that. It worked fine in my tests, but that doesn’t mean there isn’t an issue. If the pkg format works, Stick with that.
Good to know. I've updated the installation info on the GitHub release.
Glad it's working well for you!
Closing NI correctly is somewhat complicated on macOS because of the special way how the system handles closing applications in general.
There is a Quit command in the "NearInfinity" menu which is automatically created by the system. There is also the Command+Q shortcut to close NI which is also overridden by the system. Both options are currently not properly handled by NI, so any options that were changed by the user are not saved.
I haven't found a feasible way to fix this issue yet, since it requires access to platform-specific code which is not available on other systems.
To ensure that options, bookmarks, and other changes are saved you have to explicitly quit the app from the "Game" menu.
It sounds like macOS is running NI translocated for @jmerry. Where is NI installed? This article suggests that moving the app to another location can stop the translocation.
Another possibility would be to use xattr to remove the quantine flags altogether.
Open a Terminal in the folder with NI. Enter the following command:
On my macOS test VM is Java 17 installed, and I have experienced the same issue as @jmerry .
Try this version. I was able to use jpackage from Java 17 but have it bundle the JRE from Java 8.
https://github.com/AstroBryGuy/NearInfinity-OSX/releases/download/v2.3-20220906/NearInfinity-2.3.20220906a.pkg
Other aspects of the state persisted as well, such as opening on that new bookmark instead of always on my main (now with SoD) instance of BGEE.
@Argent77 - What version are you seeing? This is what I see on boot up of NI, with the new build (using Java 8 JRE):
I built the package using the Adoptium Java version 8 JRE, which is 8u345.
I'm glad jpackage (which wasn't a thing until Java 14) can build a package with the Java 8 JRE!
Nevermind, it works now. It was probably a side effect of not removing the old package before installing the new one.
Full Changelog:
FYI for macOS users - NearInfinity-OSX is updated to v2.3-20221108.
https://github.com/AstroBryGuy/NearInfinity-OSX/releases/tag/v2.3-20221108