class Fontist::InstallLocations::UserLocation
User font directory location
This location represents the user-specific font directory, with platform-specific base paths:
macOS: ~/Library/Fonts/fontist/ Linux: ~/.local/share/fonts/fontist/ Windows: %LOCALAPPDATA%/Microsoft/Windows/Fonts/fontist/
## Managed vs Non-Managed
This location is managed when:
-
Using default path with /fontist subdirectory (default behavior)
This location is non-managed when:
-
User sets FONTIST_USER_FONTS_PATH to system root (e.g., ~/Library/Fonts)
-
In non-managed mode, fonts are added with unique names to avoid conflicts
## Customization
Set via environment variable:
export FONTIST_USER_FONTS_PATH=~/Library/Fonts/fontist
Or via config:
fontist config set user_fonts_path ~/Library/Fonts/fontist
Public Instance Methods
Source
# File lib/fontist/install_locations/user_location.rb, line 44 def base_path # Check for custom path from config/ENV custom_path = Fontist::Config.user_fonts_path return Pathname.new(File.expand_path(custom_path)) if custom_path # Default: platform-specific path + /fontist subdirectory default_user_path.join("fontist") end
Returns base installation path
Priority:
-
Custom path from
Config.user_fonts_path(if set) -
Platform default + /fontist subdirectory
@return [Pathname] User font installation directory
Source
# File lib/fontist/install_locations/user_location.rb, line 33 def location_type :user end
Returns location type identifier @return [Symbol] :user
Protected Instance Methods
Source
# File lib/fontist/install_locations/user_location.rb, line 60 def index @index ||= Fontist::Indexes::UserIndex.instance end
Returns the UserIndex instance
This index tracks all fonts installed in the user location
@return [Indexes::UserIndex] Singleton index instance
Source
# File lib/fontist/install_locations/user_location.rb, line 74 def managed_location? # If no custom path, we're using the default managed subdirectory return true unless Fontist::Config.user_fonts_path # If custom path ends with /fontist, it's managed uses_fontist_subdirectory? end
Determines if this location is managed by Fontist
User location is managed if:
-
No custom path set (uses default /fontist subdirectory), OR
-
Custom path ends with β/fontistβ subdirectory
User location is non-managed if:
-
Custom path points to system root directory (e.g., ~/Library/Fonts)
@return [Boolean] true if Fontist manages this location