diff --git a/src/config.cr b/src/config.cr index bec3ae5..33fc027 100644 --- a/src/config.cr +++ b/src/config.cr @@ -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 %} diff --git a/src/store.cr b/src/store.cr index cd91903..198846b 100644 --- a/src/store.cr +++ b/src/store.cr @@ -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) diff --git a/src/utils/directories.cr b/src/utils/directories.cr index 02f44f1..7a0157a 100644 --- a/src/utils/directories.cr +++ b/src/utils/directories.cr @@ -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