X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fos_cygwin.cpp;h=c11a6fdc081e38c6f760291ebda87d80854e4bce;hb=848c89564fce9c4bfec79b915746dc6bc47abc3d;hp=5ec1d1e3d2591e3ffa0950c2e92cb80c73299603;hpb=76799eb4932d63e92614ab480105fbd03101791c;p=lyx.git diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 5ec1d1e3d2..c11a6fdc08 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -145,45 +145,11 @@ string convert_path_list(string const & p, PathStyle const & target) void os::init(int, char *[]) { - // Copy cygwin environment variables to the Windows environment - // if they're not already there. - - char **envp = environ; - char curval[2]; - string var; - string val; - bool temp_seen = false; - - while (envp && *envp) { - val = split(*envp++, var, '='); - - if (var == "TEMP") - temp_seen = true; - - if (GetEnvironmentVariable(var.c_str(), curval, 2) == 0 - && GetLastError() == ERROR_ENVVAR_NOT_FOUND) { - /* Convert to Windows style where necessary */ - if (var == "PATH" || var == "LD_LIBRARY_PATH") { - string const winpathlist = - convert_path_list(val, PathStyle(windows)); - if (!winpathlist.empty()) { - SetEnvironmentVariable(var.c_str(), - winpathlist.c_str()); - } - } else if (var == "HOME" || var == "TMPDIR" || - var == "TMP" || var == "TEMP") { - string const winpath = - convert_path(val, PathStyle(windows)); - SetEnvironmentVariable(var.c_str(), winpath.c_str()); - } else { - SetEnvironmentVariable(var.c_str(), val.c_str()); - } - } - } - if (!temp_seen) { - string const winpath = convert_path("/tmp", PathStyle(windows)); - SetEnvironmentVariable("TEMP", winpath.c_str()); - } + // Make sure that the TEMP variable is set + // and sync the Windows environment. + + setenv("TEMP", "/tmp", false); + cygwin_internal(CW_SYNC_WINENV); }