Riscos filesystem
Skills repository for RISC OS agents
npx -y skills add gerph/riscos-agent-skills --skill riscos-filesystemAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Information about how to interact with the RISC OS filesystem. Use when RISC OS filesystem operations are not clear, or when writing code which interacts with the RISC OS filesystem.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
7.1 KB, as published. Nobody here has run it
RISC OS Filesystems information
Filename conventions
- Directory component separators are
.- this is similar to the/separator on POSIX systems.- A trailing
.is not allowed on a filename. - A leading
.is not allowed on a filename.
- A trailing
- RISC OS does not use filename extensions.
- Where compatibility or interworking is expected, the filename may include the equivalent of an extension in the form
/htmlon the end of the filename.
- Where compatibility or interworking is expected, the filename may include the equivalent of an extension in the form
- Filetypes differentiate the purposes that files have.
- Files have a type (the
filetype), which is a value from 0-0xFFF, usually expressed as a 3 hex-digit value, or a name. - Directories do not have filetypes.
- Files have a type (the
- The root specifier for a filesystem is
$which is treated as a component:$.Foowould be a fileFoowithin the root of a device. - The current working directory (knowns a the
currently selected directory, orCSD) may be referenced as@:@.Foois the fileFoowithin the current directory. %is the library directory,&is the 'user root directory' and\\is the previously selected directory. These are not commonly used.- Different filesystem drivers have separate prefixes within filenames, which may include a disc specifier.
ADFS::Disc1.$is the root of the disc labelledDisc1on the ADFS driver's devices.ADFS:$is the root of the currently selected ADFS device's disc.Parallel:$is the parallel device's root.
- Filenames, device names and disc names are case-insensitive, using the current RISC OS alphabet as the translation. UTF-8 is generally not used.
- Environment variables are expanded by the filesystem, not by the caller.
- A filename
<Boot$Dir>.Runis valid, and will be expanded by the filesystem by extracting the value of theBoot$Dirvariable and substituting it for the<...>region. - Variables may appear anywhere in a filename:
<Boot$Dir>.Choices.<User$Name>.Startwould expand both theBoot$DirandUser$Namevariables before using the filename.
- A filename
- Pseudo filesystems can be created through the use of path variables. These are variables which specify multiple filename paths which will be searched by the filesystem to resolve a candidate.
- Path variables have the form
Name$Path, and will be expanded when a path is given likeName:$.FooorName:Foo. - The value of path variables is a comma-separated list of paths to search, each of which is terminated by a
.. - If
Name$Pathwas set toADFS::4.$.Name.,RAM::Disc.$.Another.and a filename likeName:$.Foowas supplied, the filesystem will search forADFS::4.$.Name.FooandRAM::Disc.$.Another.Foo. The first found object will be further traversed. - Writing to filenames speicifed in this way will cause the
Name$Writevariable to be used in place of the path as a directory. For example, ifName$Writewas set toRAM::Disc.$.Another.and a write operation was performed onName:$.Foothe write will always happen onRAM::Disc.$.Another.Foo, even if a file namedFooexists on the ADFS path.
- Path variables have the form
- The parent directory
^can be used within paths to traverse up the directory tree.ADFS::Disc1.$.This.That.^will resolve toADFS::Disc.$.This.- The parent of the root is the root, that is
$.^is the same as$, andADFS::Disc.$.^is the same asADFS::Disc.$.
- Components who are supplied filenames should not try to decompose them, or decode their values. The filenames should be passed on directly to filesystem interfaces. Errors returned by the interfaces will indicate whether the filename is valid and whether a target filename could be resolved.
- Within RISC OS filenames,
*is a multicharacter wildcard,#is a single character wildcard. - Files have properties known as 'load' and 'exec' addresses. These are legacy from 8-bit era, but have been repurposed to hold information about the file's timestamp and its filetype.
- However, there are encodings which do not refer to a timestamp and instead directly expose the load and exec addresses as values. These are to be avoided but may be encountered.
- Access permissions on files allow for read access, write access and locking.
- These are applied for the current user, and 'other' users, usually specified in the for
LWR/WR(left side being the current user, and right side being other users). - Locked files may not be deleted.
- Files without the read or write permission will not be able to be read or written respectively.
- These are applied for the current user, and 'other' users, usually specified in the for
- File enumeration does not guarantee any ordering.
- Whilst some filesystems will enumerate objects in a sorted order, others may be random, or may return items in creation order. The order returned should never be relied upon.
- File enumeration never includes the 'current' or 'parent' in its returned values.
Host filename convention
When RISC OS files are stored on a host filesystem, they are given special treatment:
- Filenames are encoded using UTF-8 from the RISC OS Alphabet by the RISC OS filesystem. The host filesystem only deals in UTF-8.
- Root specifiers (
$) are never used on the host filesystem. - Filetypes are encoded within the filename as a suffix
,xxxwherexxxis a 3-hex digit sequence for the filtype number, left padded with0s.- A RISC OS filename of
$.Foo.Barwhich has a filetype of 0xFFD would be stored in the host filesystem asFoo/Bar,ffd.
- A RISC OS filename of
- Timestamps for the file are taken from the host filesystem's 'modification' time and implicitly encoded into the load and exec address by RISC OS implementations.
- Where load and exec addresses do not encode the filetype, but are in legacy format, these are encoded in the host filesystem as
,llllllll,eeeeeeee.
Filetypes
- Common filetypes you may need to know (used in filenames in the form
,xxx):fff- Text file (plain text, no defined encoding, but usually ISO 8859-1)ffe- Command file (used for*Exec; will be inserted into input buffer)ffd- Data file (arbitrary data)ff8- Absolute (user mode executable, usually in C)ffc- Utility (user mode executable for small operations, usually in assembly)ffa- Module (relocatable priviledged system extension, usually written in C, but historically in assembly)fd1- Textual BASIC (user mode executable in textual format)ffb- Tokenised BASIC (user mode executable in binary format)ff9- RISC OS Sprite (collection of bitmap images)fec- RISC OS Template (collection of desktop window definitions)feb- RISC OS Obey file (script containing RISC OS commands to execute)fe1- RISC OS AMU file ('Acorn Make Utility' - a makefile format)aff- RISC OS DrawFile (vector graphic)a91- Zip archive (collection of compressed files, which may include RISC OS filetype information)b60- PNG graphicc85- JPEG graphic695- GIF graphic