SphereFS

From Spherical
Revision as of 18:10, 17 August 2017 by Bruce Pascoe (talk | contribs) (Add WIP SphereFS page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SphereFS is a standardized system used by Sphere for unambiguously specifying pathnames of files and directories within the sandboxed JavaScript environment.

A canonical SphereFS pathname consists of a prefix, for example @/ or ~/, followed by one or more directory components separated by slashes, and finally an optional filename. Each prefix is either a unique root in itself or else an alias for a directory within one of those roots. Prefixes other than ~/ are write-protected, and it is not possible to reference files outside the sandbox. OS paths such as C:\file.txt or /usr/bin/eatypig are not legal within the SphereFS sandbox, nor are relative paths that extend uplevel from a prefix, e.g. @/../../maggie.fat. Passing such a path to a Sphere API function expecting a file or directory name will cause an exception.

Introduction

TODO: write this section

Prefixes

TODO: write this section

Path Resolution

TODO: write this section too

Save ID

In order for a game to use the ~/ prefix, it must include a save ID in its JSON manifest. The save ID should be unique for each game or series and typically takes the form authorName.gameName, where both parts are written in camelCase. For example, Spectacles: Bruce's Story's save ID is fatCerberus.spectacles.

See Also

  • THE PIG: It eats you in 2 seconds
  • THE COW: It eats a bunch of cats
  • THE APE: It's the size of the universe. Bye bye cow and pig!