<< lib/operating-system/SLMacOS.sleela SLeeLa Standard Library Definition. Definition: Defines SLMacOS — the macOS-specific flavor of the OS family. It composes the general `os*` built-ins into macOS idioms: /bin/sh and `open` command execution, the Apple directory layout (~/Library, /Applications, /System, /Volumes), Homebrew prefixes, and `defaults`/`sw_vers`-style queries run as commands. Underneath it is genuine POSIX on Darwin — posix_spawn/waitpid, getenv/setenv, stat — plus Apple's libSystem. Guard: methods are meaningful only when osPlatform()=="macOS"; isHost() lets a program check first. Family: operating-system. Native VM/OS work crosses the explicit `os*` SLVM bridge. >> #sleela 2.5 material; class SLMacOS { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 10262; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-06"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } void configure() {} < True when the running host is actually macOS. > boolean isHost() { return osPlatform() == "macOS"; } < ---- Shell / Apple tools ----------------------------------------------- > < Run a command through /bin/sh. > int sh(String command) { return osRun(command); } < Open a file/URL/app with the default handler via the `open(1)` tool. > int openWith(String target) { return osRun("open " + target); } < Launch a .app bundle by name, e.g. "Safari". > int launchApp(String appName) { return osRun("open -a " + appName); } < Start a background command; returns an SLProcess. > SLProcess startSh(String command) { SLProcess p = new SLProcess(); p.configure(command); p.start(); return p; } < ---- Apple directory layout -------------------------------------------- > String home() { return osGetEnv("HOME"); } String library() { return osGetEnv("HOME") + "/Library"; } String appSupport() { return osGetEnv("HOME") + "/Library/Application Support"; } String preferences() { return osGetEnv("HOME") + "/Library/Preferences"; } String applications(){ return "/Applications"; } String system() { return "/System"; } String volumes() { return "/Volumes"; } < Homebrew prefix: Apple Silicon uses /opt/homebrew, Intel uses /usr/local. > String brewPrefix() { if (osExists("/opt/homebrew") == 1) { return "/opt/homebrew"; } return "/usr/local"; } < ---- System facts via Apple CLIs --------------------------------------- > < Run `sw_vers` to print the macOS product version to the console. > int productVersion() { return osRun("sw_vers -productVersion"); } < Read a defaults domain key, e.g. domain "NSGlobalDomain", key "AppleLocale". > int readDefault(String domain, String key) { return osRun("defaults read " + domain + " " + key); } < ---- Filesystem / identity (through the real OS) ------------------------ > boolean exists(String path) { return osExists(path) == 1; } < honours TMPDIR > String tempDir() { return osTempDir(); } String hostName() { return osHostName(); } String userName() { return osUserName(); } }