Skip to content

Commit

Permalink
fix: windows related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elbywan committed Sep 25, 2023
1 parent 77ae606 commit e4cb654
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Zap
getter store_path : String = ::File.expand_path(
(
{% if flag?(:windows) %}
"%LocalAppData%/.zap/store"
"#{ENV["LocalAppData"]}/.zap/store"
{% else %}
"~/.zap/store"
{% end %}
Expand Down
4 changes: 2 additions & 2 deletions src/store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ struct Zap::Store
def initialize(store_path : String)
@global_package_store_path = ::File.join(store_path, PACKAGES_STORE_PREFIX)
@global_locks_store_path = ::File.join(store_path, LOCKS_STORE_PREFIX)
Dir.mkdir_p(@global_package_store_path)
Dir.mkdir_p(@global_locks_store_path)
Utils::Directories.mkdir_p(@global_package_store_path)
Utils::Directories.mkdir_p(@global_locks_store_path)
end

def package_path(name : String, version : String)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/directories.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module Zap::Utils::Directories

path.each_parent do |parent|
Dir.mkdir(parent, mode)
rescue e : ::File::AlreadyExistsError
rescue ::File::AlreadyExistsError | ::File::AccessDeniedError
# ignore
end
Dir.mkdir(path, mode)
rescue e : ::File::AlreadyExistsError
rescue ::File::AlreadyExistsError | ::File::AccessDeniedError
# ignore
end
end

0 comments on commit e4cb654

Please sign in to comment.