mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Use the internal function of the cygwin dll for syncing the
Windows environment. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19333 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
519e73acc8
commit
19b5ae4830
@ -145,45 +145,22 @@ string convert_path_list(string const & p, PathStyle const & target)
|
|||||||
|
|
||||||
void os::init(int, char *[])
|
void os::init(int, char *[])
|
||||||
{
|
{
|
||||||
// Copy cygwin environment variables to the Windows environment
|
// Make sure that the TEMP variable is set
|
||||||
// if they're not already there.
|
// and sync the Windows environment.
|
||||||
|
|
||||||
char **envp = environ;
|
char **envp = environ;
|
||||||
char curval[2];
|
|
||||||
string var;
|
string var;
|
||||||
string val;
|
|
||||||
bool temp_seen = false;
|
bool temp_seen = false;
|
||||||
|
|
||||||
while (envp && *envp) {
|
while (envp && *envp && !temp_seen) {
|
||||||
val = split(*envp++, var, '=');
|
split(*envp++, var, '=');
|
||||||
|
|
||||||
if (var == "TEMP")
|
if (var == "TEMP")
|
||||||
temp_seen = true;
|
temp_seen = true;
|
||||||
|
}
|
||||||
|
if (!temp_seen)
|
||||||
|
::setenv("TEMP", "/tmp", true);
|
||||||
|
|
||||||
if (GetEnvironmentVariable(var.c_str(), curval, 2) == 0
|
cygwin_internal(CW_SYNC_WINENV);
|
||||||
&& 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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user