mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-10-26 14:04:00 +03:00
looks for fonts with both otf and ttf extensions
This commit is contained in:
parent
8fe33a584e
commit
397d2637e9
@ -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…
Reference in New Issue
Block a user