- printf (_ (WARRANTY).to_str0 ());
-}
-
-static int
-sane_putenv (char const *key, String value, bool overwrite = true)
-{
- if (overwrite || !getenv (key))
- {
- String combine = String (key) + "=" + value;
- char *s = strdup (combine.to_str0 ());
- return putenv (s);
- }
- return -1;
-}
-
-static int
-set_env_file (char const *key, String value)
-{
- if (is_file (value))
- return sane_putenv (key, value, false);
- else if (be_verbose_global)
- warning (_f ("no such file: %s", value));
- return -1;
-}
-
-static int
-prepend_env_path (char const *key, String value)
-{
- if (is_dir (value))
- {
- if (char const *cur = getenv (key))
- value += to_string (PATHSEP) + cur;
-
- if (be_verbose_global)
- progress (_f ("%s=%s", key, value.to_str0 ()));
-
- return sane_putenv (key, value.to_str0 ());
- }
- else if (be_verbose_global)
- warning (_f ("no such directory: %s", value));
- return -1;
-}
-
-String
-dir_name (String const file_name)
-{
- String s = file_name;
- s.substitute ('\\', '/');
- s = s.left_string (s.index_last ('/'));
- return s;
-}
-
-#ifdef __MINGW32__
-#include <winbase.h>
-#endif
-
-void
-set_relocation (String bindir, String prefix)
-{
- if (be_verbose_global)
- warning (_f ("Relocation: compile prefix=%s, new prefix=%s",
- prefix_directory,
- prefix.to_str0 ()));
-
- String datadir = prefix + "/share";
- String libdir = prefix + "/lib";
- String localedir = datadir + "/locale";
- String sysconfdir = prefix + "/etc";
- String lilypond_datadir = datadir + "/lilypond/" TOPLEVEL_VERSION;
-
- if (is_dir (lilypond_datadir))
- prefix_directory = lilypond_datadir;
-
-#if HAVE_GETTEXT
- if (is_dir (localedir))
- bindtextdomain ("lilypond", localedir.to_str0 ());
-#endif
-
- set_env_file ("FONTCONFIG_FILE", sysconfdir + "/fonts/fonts.conf");
-#ifdef __MINGW32__
- char font_dir[PATH_MAX];
- ExpandEnvironmentStrings ("%windir%/fonts", font_dir, sizeof (font_dir));
- prepend_env_path ("GS_FONTPATH", font_dir);
-#endif
-
- /* FIXME: *cough* 8.15 *cough* */
- prepend_env_path ("GS_FONTPATH", datadir + "/ghostscript/8.15/fonts");
- prepend_env_path ("GS_LIB", datadir + "/ghostscript/8.15/Resource");
- prepend_env_path ("GS_LIB", datadir + "/ghostscript/8.15/lib");
-
- prepend_env_path ("GS_FONTPATH", datadir + "/gs/fonts");
- prepend_env_path ("GS_LIB", datadir + "/gs/Resource");
- prepend_env_path ("GS_LIB", datadir + "/gs/lib");
-
- /* need otherwise dynamic .so's aren't found. */
- prepend_env_path ("DYLD_LIBRARY_PATH", libdir);
-
- prepend_env_path ("GUILE_LOAD_PATH", datadir
- + to_string ("/guile/%d.%d",
- SCM_MAJOR_VERSION, SCM_MINOR_VERSION));
- set_env_file ("PANGO_RC_FILE", sysconfdir + "/pango/pangorc");
- prepend_env_path ("PATH", bindir);
-}
-
-String
-get_working_directory ()
-{
- char cwd[PATH_MAX];
- getcwd (cwd, PATH_MAX);
-
- return String (cwd);