mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-13 20:30:02 +00:00
looks for fonts with both otf and ttf extensions
This commit is contained in:
parent
8fe33a584e
commit
397d2637e9
1 changed files with 6 additions and 2 deletions
|
@ -9,9 +9,13 @@ let
|
|||
home = readDir path;
|
||||
list = mapAttrsToList (name: type:
|
||||
let newPath = "${path}/${name}";
|
||||
in if (type == "directory" || type == "symlink") && !(hasSuffix ".ttf" name) then readDirsRec newPath else [ newPath ]) home;
|
||||
in if (type == "directory" || type == "symlink") && !(isFont name) then readDirsRec newPath else [ newPath ]) home;
|
||||
in flatten list;
|
||||
fontFiles = dir: filter (name: hasSuffix ".ttf" name) (readDirsRec dir);
|
||||
isFont = name: let
|
||||
fontExt = [ ".ttf" ".otf" ];
|
||||
hasExt = exts: name: foldl' (acc: ext: (hasSuffix ext name) || acc) false exts;
|
||||
in hasExt fontExt name;
|
||||
fontFiles = dir: filter isFont (readDirsRec dir);
|
||||
print = font: "ln -fn '${font}' '/Library/Fonts/${baseNameOf font}'";
|
||||
in concatMapStringsSep "\n" print (fontFiles dir);
|
||||
in {
|
||||
|
|
Loading…
Add table
Reference in a new issue