Mercurial > octave
diff libinterp/corefcn/environment.cc @ 25460:627d6bde9b8d
solve installation info initialization problem differently
Back out changesets 893344cee100 and 69fc8935020b.
* defaults.h, defaults.cc: Instead of storing installation info like
include_dir, data_dir, info_dir, etc., in file-scope static variables
or a class object owned by the interpreter, store the initialized
values as constants inside the functions that return them. This way
they are initialized on demand and we don't have to worry about
initialization order of static data. It's OK for these to be static
because even though they may require some computation to intialize
(looking at environment variables or substituting the value of
OCTAVE_HOME), they are constants for any given installation of
Octave and will be the same for any instantiation of the interpreter.
Only include defaults.h in files that actually need it.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 12 Jun 2018 13:03:04 -0400 |
parents | 893344cee100 |
children | 00f796120a6d |
line wrap: on
line diff
--- a/libinterp/corefcn/environment.cc Tue Jun 12 10:31:13 2018 -0700 +++ b/libinterp/corefcn/environment.cc Tue Jun 12 13:03:04 2018 -0400 @@ -32,9 +32,9 @@ #include "pathsearch.h" #include "str-vec.h" +#include "defaults.h" #include "defun.h" #include "environment.h" -#include "installation-data.h" #include "interpreter.h" #include "variables.h" @@ -113,30 +113,25 @@ return retval; } - std::string environment::init_exec_path (interpreter& interp) + std::string environment::init_exec_path (void) { std::string exec_path = sys::env::getenv ("OCTAVE_EXEC_PATH"); std::string path_sep = directory_path::path_sep_str (); if (exec_path.empty ()) - { - installation_data& inst_data = interp.get_installation_data (); - - exec_path = (inst_data.local_ver_arch_lib_dir () + path_sep - + inst_data.local_api_arch_lib_dir () + path_sep - + inst_data.local_arch_lib_dir () + path_sep - + inst_data.arch_lib_dir () + path_sep - + inst_data.bin_dir ()); - - } + exec_path = (config::local_ver_arch_lib_dir () + path_sep + + config::local_api_arch_lib_dir () + path_sep + + config::local_arch_lib_dir () + path_sep + + config::arch_lib_dir () + path_sep + + config::bin_dir ()); append_to_shell_path (exec_path); return exec_path; } - std::string environment::init_image_path (interpreter& interp) + std::string environment::init_image_path (void) { std::string image_path = "."; @@ -147,9 +142,7 @@ if (! env_path.empty ()) image_path += path_sep + env_path; - installation_data& inst_data = interp.get_installation_data (); - - std::string gen_path = genpath (inst_data.image_dir (), ""); + std::string gen_path = genpath (config::image_dir (), ""); if (! gen_path.empty ()) image_path += path_sep + gen_path;