I’m looking for some help from the community to confirm how NetLogo directories are structured across different operating systems (OS), especially on Linux. This will help me improve the automatic detection functions in the R package logolink.
A Windows layout looks like:
C:
├─ Program Files # Or 'Program Files (x86)', for 32-bit systems
├─ NetLogo [Version (e.g., 7.0.2)] # Contains 'NetLogo_Console.exe' & 'NetLogo.exe'
├─ models
├─ [...]
On Linux, the layout varies a lot. I’ve been advocating for launching NetLogo as a Flatpak bundle (like LibreOffice), but that’s still a discussion. I normally check /opt/ and ~/.opt/ (my preference). If you use Linux, I’d appreciate knowing where you keep your NetLogo files.
A Linux layout looks like:
# Somewhere (e.g., '/opt/', '~/.opt/')
├─ NetLogo [Version (e.g., 7.0.2)] # The name may vary; contains 'NetLogo_Console' symbolic link
├─ bin # Contains the 'NetLogo' executable/binary
├─ models
├─ [...]
As for macOS: I’ve never used a Mac and I don’t have time to make a VM for it, so I’m relying on what I can find online. From the .dmg contents, it seems to follow something like:
The directory structures you provided for each platform are correct, but the exact paths you need will depend on your goal. For example, you list the contents of the .app file on Mac, but if your goal is simply to run the app, you should call open on the .app folder itself, rather than the binary file at /Contents/MacOS. If you can be more specific about how exactly R needs to communicate with NetLogo, that would help us provide information that isn’t misleading.
Regarding automatic detection: if you mean finding the location of the root NetLogo directory, you’re most likely out of luck. The standard is to install to C:/Program Files on Windows, /Applications on Mac, etc., however this is not enforced in any way. This is not helped by the fact that we allow users to have more than one NetLogo installation on a drive. Although automatic detection will work in the majority of cases, it might be good to have a fallback that allows the user to manually specify the path to their desired NetLogo version, especially if the version they want to use is not the latest version they have installed.
My issue is about calling NetLogo in headless mode from another interface. Since NetLogo always ships with a binary (or a symlink to it) in its home directory, it’s straightforward to launch it from other interfaces. The complication, as you mentioned, is that the home directory varies a lot across systems.
logolink lets users set the NetLogo home and console paths, but it helps to know the common installation paths so the package can detect them automatically. That makes the experience smoother. If the user has multiple installations, the package tries to pick the most recent one.
I think I’ve already covered the usual locations on Windows and macOS. Linux is a different story.
Ok, that makes sense. Fortunately, it doesn’t sound like you need to worry about paths to specific binaries. From the root directory of an installation, you should be able to run the netlogo-headless script on all platforms, which will automatically use the right paths for that installation!
I don’t believe we recommend any particular installation directory for Linux, so I’m not sure that you can do anything reliable there. In recent releases of NetLogo, we provide an installation script that places .desktop files in /usr/share/applications, but there’s no guarantee that people are aware of that script’s existence and have decided to run it. But planning for the future, that might be your best starting point if you’re trying to locate NetLogo installations.