directory

fun directory(directoryPath: String?): S

Sets the path to the directory that contains the realm file. If the directory does not exists, it and all intermediate directories will be created.

If not set the realm will be stored at the default app storage location for the platform:

// For Android the default directory is obtained using
Context.getFilesDir()

// For JVM platforms the default directory is obtained using
System.getProperty("user.dir")

// For macOS the default directory is obtained using
platform.Foundation.NSFileManager.defaultManager.currentDirectoryPath

// For iOS the default directory is obtained using
NSFileManager.defaultManager.URLForDirectory(
NSDocumentDirectory,
NSUserDomainMask,
null,
true,
null
)

Parameters

directoryPath

either the canonical absolute path or a relative path from the current directory ('./').