mirror of git://gcc.gnu.org/git/gcc.git
main.c (store_exe_path): Fix absolute path detection for Windows.
2012-01-11 Tobias Burnus <burnus@net-b.de>
* runtime/main.c (store_exe_path): Fix absolute path
detection for Windows.
From-SVN: r183094
This commit is contained in:
parent
1c97289f9f
commit
4dec0a42c3
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-01-11 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
|
* runtime/main.c (store_exe_path): Fix absolute path
|
||||||
|
detection for Windows.
|
||||||
|
|
||||||
2012-01-11 Janne Blomqvist <jb@gcc.gnu.org>
|
2012-01-11 Janne Blomqvist <jb@gcc.gnu.org>
|
||||||
Mike Stump <mikestump@comcast.net>
|
Mike Stump <mikestump@comcast.net>
|
||||||
PR libfortran/51803
|
PR libfortran/51803
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,8 @@ store_exe_path (const char * argv0)
|
||||||
#define DIR_SEPARATOR '/'
|
#define DIR_SEPARATOR '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char buf[PATH_MAX], *cwd, *path;
|
char buf[PATH_MAX], *path;
|
||||||
|
const char *cwd;
|
||||||
|
|
||||||
/* This can only happen if store_exe_path is called multiple times. */
|
/* This can only happen if store_exe_path is called multiple times. */
|
||||||
if (please_free_exe_path_when_done)
|
if (please_free_exe_path_when_done)
|
||||||
|
|
@ -105,15 +106,22 @@ store_exe_path (const char * argv0)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* On the simulator argv is not set. */
|
/* If the path is absolute or on a simulator where argv is not set. */
|
||||||
if (argv0 == NULL || argv0[0] == '/')
|
#ifdef __MINGW32__
|
||||||
|
if (argv0 == NULL
|
||||||
|
|| ('A' <= argv0[0] && argv0[0] <= 'Z' && argv0[1] == ':')
|
||||||
|
|| ('a' <= argv0[0] && argv0[0] <= 'z' && argv0[1] == ':')
|
||||||
|
|| (argv0[0] == '/' && argv0[1] == '/')
|
||||||
|
|| (argv0[0] == '\\' && argv0[1] == '\\'))
|
||||||
|
#else
|
||||||
|
if (argv0 == NULL || argv0[0] == DIR_SEPARATOR)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
exe_path = argv0;
|
exe_path = argv0;
|
||||||
please_free_exe_path_when_done = 0;
|
please_free_exe_path_when_done = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (buf, 0, sizeof (buf));
|
|
||||||
#ifdef HAVE_GETCWD
|
#ifdef HAVE_GETCWD
|
||||||
cwd = getcwd (buf, sizeof (buf));
|
cwd = getcwd (buf, sizeof (buf));
|
||||||
if (!cwd)
|
if (!cwd)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue