en | fr

The Paths class


Wrapper around the native path modules with some getters to access common locations.


join

Delegates to path#join.

Returns String


resolve

Delegates to path#resolve.

Parameters

Returns String


root

Path to the project’s root.

Returns String


home

Path to the user’s folder.

Returns String


music_folder

Inferred path containing the user’s musics.

Returns String


user

Path to the user’s data folder (e.g. “/home/john/.daplayer”).

Returns String


default_artwork

Path to the default artwork image.

Returns String


covers

Path to the folder containing cover images.

Returns String


artists

Path to the folder containing artist images.

Returns String


playlists

Path to the folder containing playlists.

Returns String


youtube_history

Path to the “YouTube History” playlist file

Returns String


to_make

List of paths to ensure are created when the application boots up as we may try to access to them.

Returns Array


exists

Check whether a given path exists or not.

Paths.exists('user') will return true only if Paths.user exists on the file system.

Paths.exists('/home/jacky/foo.mp3') will return true if the file exists on system.

Parameters

Returns Boolean


mkdir

Creates a new directory getting the wanted path delegating to the given getter’s name.

Paths.mkdir('user') will create the Paths.user folder.

We are relying on the synchronous counter-part of mkdir since we want to block the event loop creating folders.

Parameters

Returns null


touchYouTubeHistory

Touches the JSPF file for the YouTube history.

We are not relying on the LocalModel#savePlaylist method as this would do extra computation to guess the file name and we want to save this file synchronously to avoid race conditions plus we don’t have to require anything else apart from this file in the main.js one.

Returns null


for

Returns the exact file’s path to store a file that’s going to be downloaded based on the title, the artist and the service.

Parameters

Returns String