Path management for publishing 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 publishing/blogging root.
Removes the legacy root directory if it's empty.
Ensures the folder for a publishing group exists. For new groups, creates in the new "publishing" directory. For existing groups, uses their current location.
Returns the path for a specific publishing 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 publishing groups still in the legacy location.
Checks if a specific publishing group is stored in the legacy "blogging" directory.
Returns the legacy blogging root path.
Migrates a publishing group from the legacy "blogging" directory to the new "publishing" directory. Returns {:ok, new_path} on success, {:error, reason} on failure.
Returns the new publishing root path.
Returns the root path for reading content.
Prefers new "publishing" 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 "publishing" 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 publishing/blogging root.
@spec cleanup_empty_legacy_root() :: :ok
Removes the legacy root directory if it's empty.
Ensures the folder for a publishing group exists. For new groups, creates in the new "publishing" directory. For existing groups, uses their current location.
Returns the path for a specific publishing 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 publishing groups still in the legacy location.
Checks if a specific publishing group is stored in the legacy "blogging" directory.
@spec legacy_root_path() :: String.t()
Returns the legacy blogging root path.
Migrates a publishing group from the legacy "blogging" directory to the new "publishing" directory. Returns {:ok, new_path} on success, {:error, reason} on failure.
@spec new_root_path() :: String.t()
Returns the new publishing root path.
@spec root_path() :: String.t()
Returns the root path for reading content.
Prefers new "publishing" 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 "publishing" path.