Path management for pages storage.
Handles root paths, group paths, legacy/new path resolution, and path utilities for the filesystem storage system.
Summary
Functions
Returns the absolute path for a relative blogging path. Handles per-blog legacy/new path resolution.
Cleans up empty directories going up from a path. Stops at the pages/blogging root.
Removes the legacy root directory if it's empty.
Ensures the folder for a pages group exists. For new groups, creates in the new "pages" directory. For existing groups, uses their current location.
Returns the path for a specific pages group, checking both new and legacy locations. Returns the path where the group actually exists, or the new path if it doesn't exist yet.
Returns whether there are any pages groups still in the legacy location.
Checks if a specific pages group is stored in the legacy "blogging" directory.
Returns the legacy blogging root path.
Migrates a pages group from the legacy "blogging" directory to the new "pages" directory. Returns {:ok, new_path} on success, {:error, reason} on failure.
Returns the new pages root path.
Returns the root path for reading content.
Prefers new "pages" path, falls back to legacy "blogging" path.
For writing new content, use write_root_path/0 instead.
Returns the write root path for creating new groups. Always returns the new "pages" path.
Functions
Returns the absolute path for a relative blogging path. Handles per-blog legacy/new path resolution.
@spec cleanup_empty_dirs(String.t()) :: :ok
Cleans up empty directories going up from a path. Stops at the pages/blogging root.
@spec cleanup_empty_legacy_root() :: :ok
Removes the legacy root directory if it's empty.
Ensures the folder for a pages group exists. For new groups, creates in the new "pages" directory. For existing groups, uses their current location.
Returns the path for a specific pages group, checking both new and legacy locations. Returns the path where the group actually exists, or the new path if it doesn't exist yet.
@spec has_legacy_groups?() :: boolean()
Returns whether there are any pages groups still in the legacy location.
Checks if a specific pages group is stored in the legacy "blogging" directory.
@spec legacy_root_path() :: String.t()
Returns the legacy blogging root path.
Migrates a pages group from the legacy "blogging" directory to the new "pages" directory. Returns {:ok, new_path} on success, {:error, reason} on failure.
@spec new_root_path() :: String.t()
Returns the new pages root path.
@spec root_path() :: String.t()
Returns the root path for reading content.
Prefers new "pages" path, falls back to legacy "blogging" path.
For writing new content, use write_root_path/0 instead.
@spec write_root_path() :: String.t()
Returns the write root path for creating new groups. Always returns the new "pages" path.