Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility methods to retrieve the absolute path of the data dir #154

Merged
merged 3 commits into from
Jan 4, 2020

Conversation

AlCalzone
Copy link
Collaborator

This PR adds two utility methods to retrieve the absolute path of the data dir. The method included in JS-Controller uses relative paths, which can lead to undesired behavior while developing with npm-linked modules. getAbsoluteInstanceDataDir was added to have a tidy data directory (preferably separate subdirectories by instance).

getAbsoluteDefaultDataDir

const dataDir = utils.getAbsoluteDefaultDataDir();

This returns the absolute path of the data directory for the current host. On linux, this is usually /opt/iobroker/iobroker-data

getAbsoluteInstanceDataDir

// old style
const instanceDataDir = utils.getAbsoluteInstanceDataDir(adapter);
// new style (classes)
const instanceDataDir = utils.getAbsoluteInstanceDataDir(this);

Returns the absolute path of the data directory for the current adapter instance.
On linux, this is usually /opt/iobroker/iobroker-data/<adapterName>.<instanceNr>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant