Commit f5c0baf1 authored by Marc Boquet's avatar Marc Boquet

[Config] Normalize installation_root to ensure same character encoding

Some characters like "ü" where being represented as `["u", "̈"]` in
ruby < 2.3 and it caused errors down the line.
parent d50ef008
......@@ -24,6 +24,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Jan Berkel](https://github.com/jberkel)
[#5319](https://github.com/CocoaPods/CocoaPods/pull/5319)
* Avoid removing all files when root directory contains unicode characters.
[Marc Boquet](https://github.com/marcboquet)
[#5294](https://github.com/CocoaPods/CocoaPods/issues/5294)
## 1.0.0 (2016-05-10)
##### Enhancements
......
require 'active_support/multibyte/unicode'
module Pod
# Stores the global configuration of CocoaPods.
#
......@@ -145,7 +147,8 @@ module Pod
# Podfile is located.
#
def installation_root
current_path = Pathname.pwd
current_dir = ActiveSupport::Multibyte::Unicode.normalize(Dir.pwd)
current_path = Pathname.new(current_dir)
unless @installation_root
until current_path.root?
if podfile_path_in_dir(current_path)
......
......@@ -112,6 +112,15 @@ module Pod
end
end
it 'returns the working directory correctly when it includes unicode characters' do
unicode_directory = temporary_directory + "ü"
FileUtils.mkdir(unicode_directory)
Dir.chdir(unicode_directory) do
File.open('Podfile', 'w') {}
@config.installation_root.to_s.should == unicode_directory.to_s
end
end
before do
@config.installation_root = temporary_directory
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment