Skeudenn / main/db/path-roots / PathRoots
Class: PathRoots ​
Defined in: src/main/db/path-roots.ts:91
The library folders as this machine sees them. The database keeps a book under a folder as root:<id>/<path relative to the folder> (forward slashes, whatever the OS), and each machine says where folder <id> is, so a library on a shared drive, a cloud folder or a network share opens from any path. A book outside every folder keeps its absolute path.
The mapping is also what the codec uses: encode() picks the deepest folder that contains the file, decode() joins the folder's path here with the relative part. A stored path whose folder has no path on this machine decodes to itself, which no file matches (the book reads as missing until the folder is relinked), and encodes back to itself.
Implements ​
Constructors ​
Constructor ​
new PathRoots(
store?):PathRoots
Defined in: src/main/db/path-roots.ts:94
Parameters ​
store? ​
RootsStore = ...
Returns ​
PathRoots
Methods ​
decode() ​
decode(
stored):string
Defined in: src/main/db/path-roots.ts:122
The absolute path, on this machine, of a stored path.
Parameters ​
stored ​
string
Returns ​
string
Implementation of ​
encode() ​
encode(
filePath):string
Defined in: src/main/db/path-roots.ts:109
The form to store (and compare in SQL) for the absolute path filePath.
Parameters ​
filePath ​
string
Returns ​
string
Implementation of ​
get() ​
get(
id):string|undefined
Defined in: src/main/db/path-roots.ts:99
This machine's path of folder id, or undefined when it has none.
Parameters ​
id ​
string
Returns ​
string | undefined
set() ​
set(
id,folderPath):void
Defined in: src/main/db/path-roots.ts:104
Says where folder id is on this machine, and remembers it.
Parameters ​
id ​
string
folderPath ​
string
Returns ​
void