mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (file_expand_path): fix for short file name on Cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9aceaa1129
commit
04351d9558
2 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat May 17 23:53:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* file.c (file_expand_path): fix for short file name on Cygwin.
|
||||||
|
|
||||||
Sat May 17 18:03:52 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
Sat May 17 18:03:52 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
* vm.c (Init_VM): removed the definition of Thread#initialize,
|
* vm.c (Init_VM): removed the definition of Thread#initialize,
|
||||||
|
|
12
file.c
12
file.c
|
@ -2827,15 +2827,20 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
|
||||||
|
|
||||||
#if USE_NTFS
|
#if USE_NTFS
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (!strpbrk(b = buf, "*?")) {
|
if (1 &&
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
!(buf[0] == '/' && !buf[1]) &&
|
||||||
|
#endif
|
||||||
|
!strpbrk(b = buf, "*?")) {
|
||||||
size_t len;
|
size_t len;
|
||||||
WIN32_FIND_DATA wfd;
|
WIN32_FIND_DATA wfd;
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
int lnk_added = 0;
|
int lnk_added = 0, is_symlink = 0;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char w32buf[MAXPATHLEN], sep = 0;
|
char w32buf[MAXPATHLEN], sep = 0;
|
||||||
p = 0;
|
p = 0;
|
||||||
if (lstat(buf, &st) == 0 && S_ISLNK(st.st_mode)) {
|
if (lstat(buf, &st) == 0 && S_ISLNK(st.st_mode)) {
|
||||||
|
is_symlink = 1;
|
||||||
p = strrdirsep(buf);
|
p = strrdirsep(buf);
|
||||||
if (!p) p = skipprefix(buf);
|
if (!p) p = skipprefix(buf);
|
||||||
if (p) {
|
if (p) {
|
||||||
|
@ -2848,8 +2853,7 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
|
||||||
}
|
}
|
||||||
if (p) *p = sep;
|
if (p) *p = sep;
|
||||||
else p = buf;
|
else p = buf;
|
||||||
if (b == w32buf) {
|
if (is_symlink && b == w32buf) {
|
||||||
strlcat(w32buf, p, sizeof(w32buf));
|
|
||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
if (len > 4 && STRCASECMP(p + len - 4, ".lnk") != 0) {
|
if (len > 4 && STRCASECMP(p + len - 4, ".lnk") != 0) {
|
||||||
lnk_added = 1;
|
lnk_added = 1;
|
||||||
|
|
Loading…
Reference in a new issue