RaggieScript v1.3.0
Browse Table of Contents (17 chapters)
Getting Started (2)
Language Reference (4)
Core Standard Library (3)
Windows, MSI SQL & Native FFI (3)
Wizard UI & Studio Sandboxes (3)
Diagnostics & Bytecode ISA (2)
Master Symbol Index
5 min read Module: raggiesoft.raggiescript F1: IDH_RSSC_NS_FS_REG (0x2009)

fs.* & reg.* — Transactional Filesystem & Stateless 64/32-Bit Registry

fs.* and reg.* are gated to use installer; (and use showcase; in Community/Architect editions; blocked in sandboxed profiles via RSW702). Every mutating call is 100% rollback-journaled inside install { ... } and rejected inside wizard { ... } by RSW701.

fs.* — Read-Only Inspection & Cryptographic Verification (19 Methods)

MethodSignatureReturnDescription
fs.existsfs.exists(target: path)boolReturns true if file or directory exists.
fs.isDirfs.isDir(target: path)boolReturns true if target is an existing directory.
fs.isFilefs.isFile(target: path)boolReturns true if target is a regular file.
fs.isLockedfs.isLocked(file: path)boolProbes CreateFileW with exclusive sharing (0) to check if another process holds a file lock.
fs.sizefs.size(file: path)intReturns file size in bytes (0 if missing).
fs.joinfs.join(part1: any, part2: any, ...)pathJoins up to 8 path segments cleanly (functional equivalent of a / b).
fs.parentfs.parent(target: path)pathReturns the parent directory path.
fs.fileNamefs.fileName(target: path)stringReturns filename including extension ("Workbench.exe").
fs.stemfs.stem(target: path)stringReturns filename without extension ("Workbench").
fs.extfs.ext(target: path)stringReturns extension including leading dot (".exe").
fs.tempDirfs.tempDir(subName?: string)pathResolves or allocates a scoped directory inside %TEMP%.
fs.tempFilefs.tempFile(prefix?: string, ext?: string)pathAllocates a unique temporary file path.
fs.fileVersionfs.fileVersion(pePath: path)versionReads PE VS_FIXEDFILEINFO (GetFileVersionInfoW) as a 4-part SemVer value!
fs.sha256fs.sha256(file: path)stringComputes lowercase 64-char hex SHA-256 via Windows CNG bcrypt.dll.
fs.verifyAuthenticodefs.verifyAuthenticode(pePath: path)boolVerifies PE Authenticode signature chain via WinVerifyTrust(WINTRUST_ACTION_GENERIC_VERIFY_V2).
fs.findFilesfs.findFiles(dir: path, pattern?: string, recursive?: bool)arrayEnumerates matching file path items in dir.
fs.readTextfs.readText(file: path)stringReads a UTF-8 text file (stripping optional UTF-8 BOM).
fs.readLinesfs.readLines(file: path)arrayReads UTF-8 lines into a string[] array.
fs.readJsonfs.readJson(file: path)anyReads and parses a UTF-8 JSON file into maps/arrays/primitives.

fs.* — Rollback-Journaled Mutations & RSWPAK1 Extraction (15 Methods)

MethodSignatureReturnRollback Behavior (.rsw-rollback.jnl)
fs.writeTextfs.writeText(file: path, content: string)boolSnapshots existing file to .rswbak (or records created file for deletion on fault).
fs.appendTextfs.appendText(file: path, text: string)boolSnapshots prior file bytes to .rswbak before appending.
fs.writeJsonfs.writeJson(file: path, value: any, pretty?: bool)boolAtomically serializes structured JSON (with .rswbak protection).
fs.writeBytesHexfs.writeBytesHex(file: path, hexString: string)boolWrites decoded binary bytes with .rswbak rollback protection.
fs.mkdirfs.mkdir(dir: path)boolCreates missing parent/target directories and journals newly created folders in LIFO order.
fs.copyfs.copy(src: path, dst: path, overwrite?: bool)boolCopies src -> dst (overwrite = true default), backing up any prior dst to .rswbak.
fs.copyTreefs.copyTree(srcDir: path, dstDir: path, progressLabel?: string)boolRecursively copies an entire directory tree with per-file rollback entries.
fs.movefs.move(src: path, dst: path)boolMoves/renames src -> dst with rollback restoration.
fs.removefs.remove(file: path)boolBacks up file to .rswbak during install so fault rollback restores deleted files!
fs.removeDirfs.removeDir(dir: path)boolRemoves directory tree if present.
fs.removeTreefs.removeTree(dir: path)boolAlias for fs.removeDir(dir).
fs.removeTreeIfExistsfs.removeTreeIfExists(dir: path)boolSafely removes dir without error when already absent.
fs.setAttributesfs.setAttributes(target: path, readOnly?: bool, hidden?: bool, system?: bool)boolUpdates Win32 file attributes (SetFileAttributesW).
fs.setNtfsCompressionfs.setNtfsCompression(target: path, enabled?: bool)boolEnables/disables transparent NTFS LZNT1 compression (FSCTL_SET_COMPRESSION).
fs.extractfs.extract(payloadId?: string, to?: path, feature?: string)intExtracts embedded LZMS RSWPAK1 (#220) files into to (default installDir), returning extracted file count!

reg.* — Stateless 64-Bit & 32-Bit WOW64 Windows Registry (13 Methods)

MethodSignatureReturnMutating?Description
reg.existsreg.exists(hive: string, key: string, valueName?: string, view?: string)boolRead-OnlyChecks whether key (or valueName when non-empty) exists.
reg.readreg.read(hive: string, key: string, valueName: string, fallback?: any, view?: string)anyRead-OnlyReads string or integer value—returning null when absent so ?? null-coalescing chains work naturally!
reg.readStringreg.readString(hive: string, key: string, valueName: string, fallback?: string, view?: string)stringRead-OnlyReads REG_SZ or REG_EXPAND_SZ string (returning fallback or "" when missing).
reg.readDwordreg.readDword(hive: string, key: string, valueName: string, fallback?: int, view?: string)intRead-OnlyReads REG_DWORD or REG_QWORD integer.
reg.listSubkeysreg.listSubkeys(hive: string, key: string, view?: string)arrayRead-OnlyEnumerates child subkey names as a string[] array (RegView.Both merges 64-bit & WOW6432Node!).
reg.listValuesreg.listValues(hive: string, key: string, view?: string)arrayRead-OnlyEnumerates value names under key as a string[] array.
reg.writereg.write(hive: string, key: string, valueName: string, value: any, view?: string)boolMutating (RSW701)Writes REG_SZ (for strings/paths) or REG_DWORD (for int/bool) with full prior-value rollback journaling.
reg.writeStringreg.writeString(hive: string, key: string, valueName: string, value: string, view?: string)boolMutating (RSW701)Writes REG_SZ UTF-16 string value (rollback-journaled).
reg.writeExpandStringreg.writeExpandString(hive: string, key: string, valueName: string, value: string, view?: string)boolMutating (RSW701)Writes REG_EXPAND_SZ unexpanded %VAR% string (rollback-journaled).
reg.writeDwordreg.writeDword(hive: string, key: string, valueName: string, value: int, view?: string)boolMutating (RSW701)Writes 32-bit REG_DWORD value (rollback-journaled).
reg.appendMultiStringreg.appendMultiString(hive: string, key: string, valueName: string, item: string, view?: string)boolMutating (RSW701)Idempotently appends item to a REG_MULTI_SZ list without duplicating existing entries.
reg.deleteValuereg.deleteValue(hive: string, key: string, valueName: string, view?: string)boolMutating (RSW701)Deletes valueName (prior value saved in .rsw-rollback.jnl for automatic restoration on fault).
reg.deleteKeyTreereg.deleteKeyTree(hive: string, key: string, view?: string)boolMutating (RSW701)Recursively deletes key (RegDeleteTreeW).
// Clean null-coalescing lookup across HKCU -> 64-bit HKLM -> Program Files fallback!
let hostDir = reg.read(Hive.HKCU, r"Software\RaggieSoft\Book Reader", "Install Path")
           ?? reg.read(Hive.HKLM, r"SOFTWARE\RaggieSoft\Book Reader", "Install Path", view: RegView.Native64)
           ?? (sys.programFiles / "RaggieSoft" / "Book Reader");
Indexed API Calls & Symbols on This Page (33):