Skip to content

Commit

Permalink
Updated Uri scheme documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcouch-sil committed Feb 9, 2024
1 parent 20e72a5 commit 2c4bc81
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/node/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import os from 'os';
import { Uri } from '@shared/data/file-system.model';
import memoizeOne from 'memoize-one';

// FOR SCHEME DOCUMENTATION, SEE Uri JSDOC
const APP_SCHEME = 'app';
const CACHE_SCHEME = 'cache';
const CACHE_DIR_NAME = CACHE_SCHEME;
Expand Down Expand Up @@ -40,6 +41,7 @@ export const getAppDir = memoizeOne((): string => {
: path.join(__dirname, '../../../dev-appdata');
});

// FOR SCHEME DOCUMENTATION, SEE Uri JSDOC
/** Get a mapping from scheme to the absolute path to that scheme. */
// TODO: this is currently lazy-loaded because globalThis doesn't get populated until after this
// file is imported. Fix this to be a normal object after fixing globalThis import dependencies.
Expand Down
17 changes: 14 additions & 3 deletions src/shared/data/file-system.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@
* Represents a path in file system or other. Has a scheme followed by :// followed by a relative
* path. If no scheme is provided, the app scheme is used. Available schemes are as follows:
*
* - `app://` - goes to the app's home directory and into `.platform.bible` (platform-dependent)
* - `app://` - goes to the `.platform.bible` directory inside the user's home directory.
*
* - On Linux and Mac, this is `$HOME/.platform.bible`
* - On Windows, this is `%USERPROFILE%/.platform.bible`
* - Note: In development, `app://` always goes to `paranext-core/dev-appdata`
* - `cache://` - goes to the app's temporary file cache at `app://cache`
* - `data://` - goes to the app's data storage location at `app://data`
* - `resources://` - goes to the resources directory installed in the app
* - `file://` - an absolute file path from root
* - `resources://` - goes to the `resources` directory inside the install directory
*
* - Note: In development, `resources://` always goes to the repo root, `paranext-core`. Not all files
* are copied into the production `resources` folder, though. See `electron-builder.json5`'s
* `extraResources` for some that are copied.
* - `file://` - an absolute file path from drive root
*
* Note: projects are stored in the production version of `app://projects` regardless of whether you
* are in production or development
*/
export type Uri = string;

0 comments on commit 2c4bc81

Please sign in to comment.