Raxol.Core.Preferences.Persistence (Raxol v0.3.0)

View Source

Handles persistence (loading/saving) of user preferences to a file.

Summary

Functions

Loads user preferences from the designated file.

Returns the full path to the user preferences file. Uses an application-specific directory.

Saves the given preferences map to the designated file.

Functions

load()

Loads user preferences from the designated file.

Returns:

  • {:ok, preferences_map} if successful.
  • {:error, :file_not_found} if the file doesn't exist.
  • {:error, reason} for other file or decoding errors.

preferences_path()

Returns the full path to the user preferences file. Uses an application-specific directory.

save(preferences)

Saves the given preferences map to the designated file.

Serializes the map using :erlang.term_to_binary.

Returns:

  • :ok on success.
  • {:error, reason} on failure.