mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ruby.c (ruby_init_loadpath): convert '\' to '/'
before finding executable file path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5de9410f00
commit
e1f055a64f
3 changed files with 19 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Feb 9 22:54:57 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby.c (ruby_init_loadpath): convert '\\' to '/'
|
||||||
|
before finding executable file path.
|
||||||
|
|
||||||
Fri Feb 8 23:53:08 2001 Usaku Nakamura <usa@osb.att.ne.jp>
|
Fri Feb 8 23:53:08 2001 Usaku Nakamura <usa@osb.att.ne.jp>
|
||||||
|
|
||||||
* win32/config.h.in (inline): add inline definition.
|
* win32/config.h.in (inline): add inline definition.
|
||||||
|
|
22
ruby.c
22
ruby.c
|
@ -214,13 +214,23 @@ ruby_init_loadpath()
|
||||||
#elif defined(DJGPP)
|
#elif defined(DJGPP)
|
||||||
extern char *__dos_argv0;
|
extern char *__dos_argv0;
|
||||||
strncpy(libpath, __dos_argv0, FILENAME_MAX);
|
strncpy(libpath, __dos_argv0, FILENAME_MAX);
|
||||||
|
#define CharNext(p) ((p) + mblen(p, MB_CUR_MAX))
|
||||||
#elif defined(__EMX__)
|
#elif defined(__EMX__)
|
||||||
_execname(libpath, FILENAME_MAX);
|
_execname(libpath, FILENAME_MAX);
|
||||||
#endif
|
#endif
|
||||||
p = strrchr(libpath, '\\');
|
|
||||||
|
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
||||||
|
#define CharNext(p) ((p) + 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (p = libpath; *p; p = CharNext(p))
|
||||||
|
if (*p == '\\')
|
||||||
|
*p = '/';
|
||||||
|
|
||||||
|
p = strrchr(libpath, '/');
|
||||||
if (p) {
|
if (p) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if (p-libpath > 3 && !strcasecmp(p-4, "\\bin")) {
|
if (p-libpath > 3 && !strcasecmp(p-4, "/bin")) {
|
||||||
p -= 4;
|
p -= 4;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
}
|
}
|
||||||
|
@ -229,14 +239,6 @@ ruby_init_loadpath()
|
||||||
p = libpath + 1;
|
p = libpath + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__CYGWIN32__)
|
|
||||||
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
|
||||||
#define CharNext(p) ((p) + 1)
|
|
||||||
#endif
|
|
||||||
for (p = libpath; *p; p = CharNext(p))
|
|
||||||
if (*p == '\\')
|
|
||||||
*p = '/';
|
|
||||||
#endif
|
|
||||||
rest = FILENAME_MAX - (p - libpath);
|
rest = FILENAME_MAX - (p - libpath);
|
||||||
|
|
||||||
#define RUBY_RELATIVE(path) (strncpy(p, (path), rest), libpath)
|
#define RUBY_RELATIVE(path) (strncpy(p, (path), rest), libpath)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.6.2"
|
#define RUBY_VERSION "1.6.2"
|
||||||
#define RUBY_RELEASE_DATE "2001-02-08"
|
#define RUBY_RELEASE_DATE "2001-02-09"
|
||||||
#define RUBY_VERSION_CODE 162
|
#define RUBY_VERSION_CODE 162
|
||||||
#define RUBY_RELEASE_CODE 20010208
|
#define RUBY_RELEASE_CODE 20010209
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue