Mercurial > octave
diff libinterp/corefcn/load-path.cc @ 31144:f125ddb46055
dir_encoding: Use encoding from .oct-config file in current directory (bug #62761).
* libinterp/corefcn/load-path.cc (load_path::read_dir_config),
libinterp/corefcn/input.cc (input_system::dir_encoding): Use canonicalized path
as key for the dir_encoding map.
* test/file-encoding: Add tests for this feature.
* test/Makefile.am: Add new folder to test suite.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Wed, 13 Jul 2022 13:20:48 +0200 |
parents | 670a0d878af1 |
children | 0f93c3a756f7 |
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc Tue Jul 12 17:52:20 2022 +0200 +++ b/libinterp/corefcn/load-path.cc Wed Jul 13 13:20:48 2022 +0200 @@ -1204,9 +1204,12 @@ void load_path::read_dir_config (const std::string& dir) const { + // use canonicalized path as key + const std::string key = sys::canonicalize_file_name (dir); + // read file with directory configuration - std::string conf_file = dir + sys::file_ops::dir_sep_str () - + ".oct-config"; + const std::string + conf_file = key + sys::file_ops::dir_sep_str () + ".oct-config"; FILE* cfile = sys::fopen (conf_file, "rb"); @@ -1216,7 +1219,7 @@ input_system& input_sys = __get_input_system__ (); std::string enc_val = "delete"; - input_sys.set_dir_encoding (dir, enc_val); + input_sys.set_dir_encoding (key, enc_val); return; } @@ -1257,7 +1260,7 @@ // set encoding for this directory in input system input_system& input_sys = __get_input_system__ (); - input_sys.set_dir_encoding (dir, enc_val); + input_sys.set_dir_encoding (key, enc_val); return; } }