forked from OSchip/llvm-project
Don't have the program path be resolved when they already are when assigning g_program_filespec in the Host calls.
llvm-svn: 123355
This commit is contained in:
parent
d09776b945
commit
b332639004
|
@ -607,14 +607,14 @@ Host::GetProgramFileSpec ()
|
|||
uint32_t len = sizeof(program_fullpath);
|
||||
int err = _NSGetExecutablePath (program_fullpath, &len);
|
||||
if (err == 0)
|
||||
g_program_filespec.SetFile (program_fullpath, true);
|
||||
g_program_filespec.SetFile (program_fullpath, false);
|
||||
else if (err == -1)
|
||||
{
|
||||
char *large_program_fullpath = (char *)::malloc (len + 1);
|
||||
|
||||
err = _NSGetExecutablePath (large_program_fullpath, &len);
|
||||
if (err == 0)
|
||||
g_program_filespec.SetFile (large_program_fullpath, true);
|
||||
g_program_filespec.SetFile (large_program_fullpath, false);
|
||||
|
||||
::free (large_program_fullpath);
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ Host::GetProgramFileSpec ()
|
|||
ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
|
||||
if (len > 0) {
|
||||
exe_path[len] = 0;
|
||||
g_program_filespec = FileSpec(exe_path, true);
|
||||
g_program_filespec.SetFile(exe_path, false);
|
||||
}
|
||||
#elif defined (__FreeBSD__)
|
||||
int exe_path_mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid() };
|
||||
|
@ -632,7 +632,7 @@ Host::GetProgramFileSpec ()
|
|||
{
|
||||
char *exe_path = new char[exe_path_size];
|
||||
if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
|
||||
g_program_filespec = FileSpec(exe_path, true);
|
||||
g_program_filespec = FileSpec(exe_path, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue