Skip to content

Commit f9927e4

Browse files
committed
Implement dynamic which/where for Windows
Based on FontCustom#335
1 parent 22d6345 commit f9927e4

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

lib/fontcustom/base.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ def initialize(raw_options)
1313
@manifest = Fontcustom::Manifest.new(manifest, @options)
1414
end
1515

16+
def which
17+
if !Gem.win_platform?
18+
"which"
19+
else # on windows
20+
"where"
21+
end
22+
end
23+
1624
def compile
1725
current = checksum
1826
previous = @manifest.get(:checksum)[:previous]
@@ -31,18 +39,14 @@ def compile
3139
private
3240

3341
def check_fontforge
34-
if !Gem.win_platform?
35-
fontforge = `which fontforge`
36-
else
37-
fontforge = `where fontforge`
38-
end
42+
fontforge = `#{which} fontforge`
3943
if fontforge == "" || fontforge == "fontforge not found"
4044
raise Fontcustom::Error, "Please install fontforge first. Visit <http://fontcustom.com> for instructions."
4145
end
4246
end
4347

4448
def check_woff2
45-
woff2 = `which woff2_compress`
49+
woff2 = `#{which} woff2_compress`
4650
if woff2 == "" || woff2 == "woff2_compress not found"
4751
fail Fontcustom::Error, "Please install woff2 first. Visit <https://github.com/google/woff2> for instructions."
4852
end

0 commit comments

Comments
 (0)