@@ -20,13 +20,21 @@ module Shards
20
20
end
21
21
22
22
private def self.find_or_create_cache_path
23
- candidates = [
24
- ENV [" SHARDS_CACHE_PATH" ]?,
25
- ENV [" XDG_CACHE_HOME" ]?.try { |cache | File .join(cache, " shards" ) },
26
- ENV [" HOME" ]?.try { |home | File .join(home, " .cache" , " shards" ) },
27
- ENV [" HOME" ]?.try { |home | File .join(home, " .cache" , " .shards" ) },
28
- File .join(Dir .current, " .shards" ),
29
- ]
23
+ candidates = {% begin % }
24
+ [
25
+ ENV [" SHARDS_CACHE_PATH" ]?,
26
+ {% if flag?(:windows ) % }
27
+ ENV [" LOCALAPPDATA" ]?.try { |dir | File .join(dir, " shards" , " cache" ) },
28
+ ENV [" USERPROFILE" ]?.try { |home | File .join(home, " .cache" , " shards" ) },
29
+ ENV [" USERPROFILE" ]?.try { |home | File .join(home, " .shards" ) },
30
+ {% else % }
31
+ ENV [" XDG_CACHE_HOME" ]?.try { |cache | File .join(cache, " shards" ) },
32
+ ENV [" HOME" ]?.try { |home | File .join(home, " .cache" , " shards" ) },
33
+ ENV [" HOME" ]?.try { |home | File .join(home, " .cache" , " .shards" ) },
34
+ {% end % }
35
+ File .join(Dir .current, " .shards" ),
36
+ ]
37
+ {% end % }
30
38
31
39
candidates.each do |candidate |
32
40
next unless candidate
0 commit comments