From fbae2bf8641db16778ddd4348b6cb7a1115d5cca Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 5 Feb 2006 18:18:02 +0000 Subject: * environ.cc (struct parse_thing): Add transparent_exe option. * fhandler_disk_file.cc (fhandler_disk_file::link): Accomodate transparent_exe option. Add .exe suffix for links to executable files, if transparent_exe is set. * fhandler_process.cc (fhandler_process::fill_filebuf): Remove .exe suffix if transparent_exe option is set. * path.cc (symlink_worker): Accomodate transparent_exe option. (realpath): Don't tack on .exe suffix if transparent_exe is set. * syscalls.cc (transparent_exe): New global variable. (unlink): Accomodate transparent_exe option. (open): Ditto. (link): Ditto. (rename): Ditto. Maybe add .exe suffix when renaming executable files. (pathconf): Accomodate transparent_exe option. * winsup.h: Declare transparent_exe. --- winsup/cygwin/path.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 45dc57947..4029ec5eb 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2675,6 +2675,8 @@ int symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, bool isdevice) { + extern suffix_info stat_suffixes[]; + HANDLE h; int res = -1; path_conv win32_path, win32_oldpath; @@ -2704,7 +2706,8 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, goto done; } - win32_path.check (newpath, PC_SYM_NOFOLLOW); + win32_path.check (newpath, PC_SYM_NOFOLLOW, + transparent_exe ? stat_suffixes : NULL); if (use_winsym && !win32_path.exists ()) { strcpy (from, newpath); @@ -2753,7 +2756,8 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, ITEMIDLIST field. */ if (GetFileAttributes (reloldpath) == INVALID_FILE_ATTRIBUTES) { - win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW); + win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, + transparent_exe ? stat_suffixes : NULL); if (win32_oldpath.error != ENOENT) strcpy (use_winsym ? reloldpath : w32oldpath, win32_oldpath); } @@ -2761,7 +2765,8 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, strcpy (w32oldpath, reloldpath); if (use_winsym) { - win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW); + win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, + transparent_exe ? stat_suffixes : NULL); strcpy (w32oldpath, win32_oldpath); } if (cp) @@ -2772,7 +2777,8 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, } else { - win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW); + win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, + transparent_exe ? stat_suffixes : NULL); strcpy (w32oldpath, win32_oldpath); } create_how = CREATE_NEW; @@ -3723,7 +3729,7 @@ realpath (const char *path, char *resolved) { /* Check for the suffix being tacked on. */ int tack_on = 0; - if (real_path.known_suffix) + if (!transparent_exe && real_path.known_suffix) { char *c = strrchr (real_path.normalized_path, '.'); if (!c || !strcasematch (c, real_path.known_suffix)) -- cgit v1.2.3