Skip to content

Commit

Permalink
Changed dataset directory to match XDG Base Directory Specification
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 22, 2024
1 parent ea86eff commit e54ccf7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
bundler-cache: true
- uses: actions/cache@v4
with:
path: ~/.disco
key: disco
path: ~/.cache/disco
key: disco-v2
- run: bundle exec rake test
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 0.5.0 (unreleased)

- Changed dataset directory to match XDG Base Directory Specification
- Dropped support for marshal serialization
- Dropped support for Ruby < 3.1 and Rails < 7

Expand Down
5 changes: 2 additions & 3 deletions lib/disco/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def download_file(fname, origin, file_hash:)
require "net/http"
require "tmpdir"

# TODO handle this better
raise "No HOME" unless ENV["HOME"]
dest = "#{ENV["HOME"]}/.disco/#{fname}"
cache_home = ENV["XDG_CACHE_HOME"] || "#{ENV.fetch("HOME")}/.cache"
dest = "#{cache_home}/disco/#{fname}"
FileUtils.mkdir_p(File.dirname(dest))

return dest if File.exist?(dest)
Expand Down

0 comments on commit e54ccf7

Please sign in to comment.