4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-30 19:10:36 +08:00

* path.cc (symlink): Keep relative paths relative in the DOS

path inside of a shortcut. If that's impossible or the target
        path is already absolute save an absolute path.
This commit is contained in:
Corinna Vinschen 2001-02-22 16:26:13 +00:00
parent ff413a9894
commit 659b480b8a
2 changed files with 14 additions and 11 deletions

View File

@ -1,8 +1,8 @@
Thu Feb 22 17:09:00 2001 Corinna Vinschen <corinna@vinschen.de> Thu Feb 22 17:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink): Keep relative paths relative in the DOS * path.cc (symlink): Keep relative paths relative in the DOS
path inside of a shortcut. If that's impossible for some path inside of a shortcut. If that's impossible or the target
reason, save an absolute path. path is already absolute save an absolute path.
Thu Feb 22 15:33:00 2001 Corinna Vinschen <corinna@vinschen.de> Thu Feb 22 15:33:00 2001 Corinna Vinschen <corinna@vinschen.de>

View File

@ -2209,7 +2209,7 @@ symlink (const char *topath, const char *frompath)
strcpy (from + len, ".lnk"); strcpy (from + len, ".lnk");
path_conv win32_path (from, PC_SYM_NOFOLLOW); path_conv win32_path (from, PC_SYM_NOFOLLOW);
path_conv win32_topath; path_conv win32_topath;
char cwd[MAX_PATH + 1], *cp, c = 0; char cwd[MAX_PATH + 1], *cp = NULL, c = 0;
char w32topath[MAX_PATH + 1]; char w32topath[MAX_PATH + 1];
#endif #endif
@ -2265,18 +2265,21 @@ symlink (const char *topath, const char *frompath)
res = 0; res = 0;
} }
#else #else
getcwd (cwd, MAX_PATH + 1); if (!isabspath (topath))
if ((cp = strrchr (from, '/')) || (cp = strrchr (from, '\\')))
{ {
c = *cp; getcwd (cwd, MAX_PATH + 1);
*cp = '\0'; if ((cp = strrchr (from, '/')) || (cp = strrchr (from, '\\')))
chdir (from); {
c = *cp;
*cp = '\0';
chdir (from);
}
backslashify (topath, w32topath, 0);
} }
backslashify (topath, w32topath, 0); if (!cp || GetFileAttributes (w32topath) == (DWORD)-1)
if (GetFileAttributes (w32topath) == (DWORD)-1)
{ {
win32_topath.check (topath, PC_SYM_NOFOLLOW); win32_topath.check (topath, PC_SYM_NOFOLLOW);
if (win32_topath.error != ENOENT) if (!cp || win32_topath.error != ENOENT)
strcpy (w32topath, win32_topath); strcpy (w32topath, win32_topath);
} }
if (cp) if (cp)