Merge pull request #8724 from chrisroberts/fix/windows-cwd-check
Set encoding when reading/writing cwd file
This commit is contained in:
commit
d1a589c59f
|
@ -571,19 +571,24 @@ module Vagrant
|
||||||
# from its previous location on disk. If the machine
|
# from its previous location on disk. If the machine
|
||||||
# has moved, it prints a warning to the user.
|
# has moved, it prints a warning to the user.
|
||||||
def check_cwd
|
def check_cwd
|
||||||
|
desired_encoding = @env.root_path.to_s.encoding
|
||||||
vagrant_cwd_filepath = @data_dir.join('vagrant_cwd')
|
vagrant_cwd_filepath = @data_dir.join('vagrant_cwd')
|
||||||
vagrant_cwd = if File.exist?(vagrant_cwd_filepath)
|
vagrant_cwd = if File.exist?(vagrant_cwd_filepath)
|
||||||
File.read(vagrant_cwd_filepath).chomp
|
File.read(vagrant_cwd_filepath,
|
||||||
end
|
external_encoding: desired_encoding
|
||||||
|
).chomp
|
||||||
|
end
|
||||||
|
|
||||||
if vagrant_cwd.nil?
|
if vagrant_cwd != @env.root_path.to_s
|
||||||
File.write(vagrant_cwd_filepath, @env.root_path)
|
if vagrant_cwd
|
||||||
elsif vagrant_cwd != @env.root_path.to_s
|
ui.warn(I18n.t(
|
||||||
ui.warn(I18n.t(
|
'vagrant.moved_cwd',
|
||||||
'vagrant.moved_cwd',
|
old_wd: "#{vagrant_cwd}",
|
||||||
old_wd: vagrant_cwd,
|
current_wd: "#{@env.root_path.to_s}"))
|
||||||
current_wd: @env.root_path.to_s))
|
end
|
||||||
File.write(vagrant_cwd_filepath, @env.root_path)
|
File.write(vagrant_cwd_filepath, @env.root_path.to_s,
|
||||||
|
external_encoding: desired_encoding
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -167,8 +167,8 @@ en:
|
||||||
%{list}
|
%{list}
|
||||||
moved_cwd: |-
|
moved_cwd: |-
|
||||||
This machine used to live in %{old_wd} but it's now at %{current_wd}.
|
This machine used to live in %{old_wd} but it's now at %{current_wd}.
|
||||||
Please change the name of the machine if you want to run it as a different
|
Depending on your current provider you may need to change the name of
|
||||||
machine.
|
the machine to run it as a different machine.
|
||||||
guest_deb_installing_smb: |-
|
guest_deb_installing_smb: |-
|
||||||
Installing SMB "mount.cifs"...
|
Installing SMB "mount.cifs"...
|
||||||
global_status_footer: |-
|
global_status_footer: |-
|
||||||
|
|
Loading…
Reference in New Issue