4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: The swapfile is created using the destination of a symlink, but
12 recovery doesn't follow symlinks.
13 Solution: When recovering, resolve symlinks. (James Vega)
17 *** ../vim-7.2.426/src/memline.c 2010-03-10 14:46:21.000000000 +0100
18 --- src/memline.c 2010-05-14 17:28:29.000000000 +0200
23 static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype));
25 + #ifdef HAVE_READLINK
26 + static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
30 * Open a new memline for "buf".
39 ! /* use msg() to start the scrolling properly */
40 msg((char_u *)_("Swap files found:"));
47 + char_u *fname_res = *fname;
48 + #ifdef HAVE_READLINK
49 + char_u fname_buf[MAXPATHL];
51 + /* Expand symlink in the file name, because the swap file is created with
52 + * the actual file instead of with the symlink. */
53 + if (resolve_symlink(*fname, fname_buf) == OK)
54 + fname_res = fname_buf;
59 ! /* use msg() to start the scrolling properly */
60 msg((char_u *)_("Swap files found:"));
68 ! num_names = recov_file_names(names, *fname, TRUE);
70 else /* check directory dir_name */
76 ! num_names = recov_file_names(names, fname_res, TRUE);
78 else /* check directory dir_name */
82 if (after_pathsep(dir_name, p) && p[-1] == p[-2])
84 /* Ends with '//', Use Full path for swap name */
85 ! tail = make_percent_swname(dir_name, *fname);
90 ! tail = gettail(*fname);
91 tail = concat_fnames(dir_name, tail, TRUE);
95 if (after_pathsep(dir_name, p) && p[-1] == p[-2])
97 /* Ends with '//', Use Full path for swap name */
98 ! tail = make_percent_swname(dir_name, fname_res);
103 ! tail = gettail(fname_res);
104 tail = concat_fnames(dir_name, tail, TRUE);
112 #if defined(VMS) || defined(RISCOS)
113 ! swapname = modname(*fname, (char_u *)"_swp", FALSE);
115 ! swapname = modname(*fname, (char_u *)".swp", TRUE);
117 if (swapname != NULL)
119 if (mch_stat((char *)swapname, &st) != -1) /* It exists! */
124 + swapname = modname(fname_res,
125 #if defined(VMS) || defined(RISCOS)
126 ! (char_u *)"_swp", FALSE
128 ! (char_u *)".swp", TRUE
131 if (swapname != NULL)
133 if (mch_stat((char *)swapname, &st) != -1) /* It exists! */
139 - static int resolve_symlink __ARGS((char_u *fname, char_u *buf));
142 * Resolve a symlink in the last component of a file name.
143 * Note that f_resolve() does it for every part of the path, we don't do that
151 char_u fname_buf[MAXPATHL];
155 #if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */
160 + char_u *fname_res = fname;
162 char_u fname_buf[MAXPATHL];
165 #if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */
168 * actual file instead of with the symlink. */
169 if (resolve_symlink(fname, fname_buf) == OK)
170 fname_res = fname_buf;
179 /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
182 - # ifdef HAVE_READLINK
189 #if defined(VMS) || defined(RISCOS)
191 *** ../vim-7.2.426/src/version.c 2010-05-14 17:32:53.000000000 +0200
192 --- src/version.c 2010-05-14 17:50:43.000000000 +0200
196 { /* Add new patch number below this line */
202 Change is inevitable, except from a vending machine.
204 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
205 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
206 \\\ download, build and distribute -- http://www.A-A-P.org ///
207 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///