diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-26 07:26:36 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-26 07:26:36 +0000 |
commit | 5212b7fb5206329151f52532e0818832186f0346 (patch) | |
tree | 1592961eaad50452efa2042a16d3ed8700161564 /file.c | |
parent | 62bab7fc22ed4668fc2cca4b85965644046a1169 (diff) | |
download | ruby-5212b7fb5206329151f52532e0818832186f0346.tar.gz |
file.c: fix for UNC
* file.c (realpath_rec): UNC prefix does not end with path separator,
so new separator is needed after it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -3350,6 +3350,13 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l VALUE testpath = rb_str_dup(*resolvedp); if (*prefixlenp < RSTRING_LEN(testpath)) rb_str_cat2(testpath, "/"); +#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER) + if (*prefixlenp > 1 && *prefixlenp == RSTRING_LEN(testpath)) { + const char *prefix = RSTRING_PTR(testpath); + const char *last = rb_enc_left_char_head(prefix, prefix + *prefixlenp - 1, prefix + *prefixlenp, enc); + if (!isdirsep(*last)) rb_str_cat2(testpath, "/"); + } +#endif rb_str_cat(testpath, testname, testnamelen); checkval = rb_hash_aref(loopcheck, testpath); if (!NIL_P(checkval)) { |