Class: Fontist::InstallLocations::UserLocation

Inherits:
BaseLocation
  • Object
show all
Defined in:
lib/fontist/install_locations/user_location.rb

Overview

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

Instance Attribute Summary

Attributes inherited from BaseLocation

#formula

Instance Method Summary collapse

Methods inherited from BaseLocation

#find_fonts, #font_exists?, #font_path, #initialize, #install_font, #permission_warning, #requires_elevated_permissions?, #uninstall_font

Constructor Details

This class inherits a constructor from Fontist::InstallLocations::BaseLocation

Instance Method Details

#base_pathPathname

Returns base installation path

Priority:

  1. Custom path from Config.user_fonts_path (if set)

  2. Platform default + /fontist subdirectory

Returns:

  • (Pathname)

    User font installation directory



42
43
44
45
46
47
48
49
# File 'lib/fontist/install_locations/user_location.rb', line 42

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

#location_typeSymbol

Returns location type identifier

Returns:

  • (Symbol)

    :user



31
32
33
# File 'lib/fontist/install_locations/user_location.rb', line 31

def location_type
  :user
end