Skeudenn / main/db/library-folder-repository / LibraryFolderRepository
Class: LibraryFolderRepository ​
Defined in: src/main/db/library-folder-repository.ts:31
The folders added to the library with "Ajouter un dossier…", and the roots the books' paths are stored relative to (see PathRoots). The database holds each folder's id and the path it had when added; where it is on this machine lives in roots. The folders themselves are common (books refer to them), but which of them a resynchronization walks is each user's choice (user_library_folders). Kept in the main process only: the renderer never names a path, it only lists them.
Constructors ​
Constructor ​
new LibraryFolderRepository(
db,roots?,userId?):LibraryFolderRepository
Defined in: src/main/db/library-folder-repository.ts:32
Parameters ​
db ​
DatabaseSync
roots? ​
PathRoots = ...
userId? ​
() => string
Returns ​
LibraryFolderRepository
Methods ​
add() ​
add(
folderPath):void
Defined in: src/main/db/library-folder-repository.ts:98
Remembers a folder and watches it for the active user; one that is already known is only watched again.
Parameters ​
folderPath ​
string
Returns ​
void
list() ​
list():
string[]
Defined in: src/main/db/library-folder-repository.ts:69
The folders a resynchronization walks for the active user, in the order they were added, as paths on this machine.
Returns ​
string[]
relink() ​
relink(
id,folderPath):boolean
Defined in: src/main/db/library-folder-repository.ts:91
Says where an unlinked folder is on this machine. False when id is not a known folder.
Parameters ​
id ​
string
folderPath ​
string
Returns ​
boolean
remove() ​
remove(
folderPath):void
Defined in: src/main/db/library-folder-repository.ts:128
Stops watching a folder for the active user. Its comics stay in the library, and the folder itself is kept since their stored paths are relative to it (and other users may watch it).
Parameters ​
folderPath ​
string
Returns ​
void
syncRoots() ​
syncRoots():
boolean
Defined in: src/main/db/library-folder-repository.ts:49
Finds, at start-up, the folders this machine has no path for yet but whose recorded path exists here (the first run after the roots appeared, or a second machine with the same layout). Returns true when one was found.
Returns ​
boolean
unlinked() ​
unlinked():
UnlinkedFolder[]
Defined in: src/main/db/library-folder-repository.ts:86
The folders (watched or forgotten) that books refer to and that have no path on this machine.