diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-23 10:08:46 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-02-23 10:08:46 (GMT) |
| commit | 06ea55d820a91810fe57afda632449d0bca2fe52 (patch) | |
| tree | 29752caf6952d7ef54869ca9af7839bbf4755366 | |
| parent | eb9f949b2cfdc79e6a450a1e4f6e3580ccde4d9f (diff) | |
| download | tcl-06ea55d820a91810fe57afda632449d0bca2fe52.zip tcl-06ea55d820a91810fe57afda632449d0bca2fe52.tar.gz tcl-06ea55d820a91810fe57afda632449d0bca2fe52.tar.bz2 | |
Simplify implementation on Cygwin: No need to use CFG_RUNTIME_BINDIR any more
| -rw-r--r-- | generic/tclZipfs.c | 16 | ||||
| -rw-r--r-- | unix/Makefile.in | 1 | ||||
| -rw-r--r-- | unix/tclUnixFile.c | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index f052c2e..4c668b0 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3113,7 +3113,7 @@ TclZipfs_TclLibrary(void) { Tcl_Obj *vfsInitScript; int found; -#if defined(_WIN32) && !defined(STATIC_BUILD) +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(STATIC_BUILD) HMODULE hModule; WCHAR wName[MAX_PATH + LIBRARY_SIZE]; char dllName[(MAX_PATH + LIBRARY_SIZE) * 3]; @@ -3148,22 +3148,20 @@ TclZipfs_TclLibrary(void) */ #if !defined(STATIC_BUILD) -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) hModule = TclWinGetTclInstance(); GetModuleFileNameW(hModule, wName, MAX_PATH); +#ifdef __CYGWIN__ + cygwin_conv_path(3, wName, dllName, sizeof(dllName)); +#else WideCharToMultiByte(CP_UTF8, 0, wName, -1, dllName, sizeof(dllName), NULL, NULL); +#endif if (ZipfsAppHookFindTclInit(dllName) == TCL_OK) { return Tcl_NewStringObj(zipfs_literal_tcl_library, -1); } #else - if (ZipfsAppHookFindTclInit( -#ifdef __CYGWIN__ - CFG_RUNTIME_BINDIR -#else - CFG_RUNTIME_LIBDIR -#endif - "/" CFG_RUNTIME_DLLFILE) == TCL_OK) { + if (ZipfsAppHookFindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_DLLFILE) == TCL_OK) { return Tcl_NewStringObj(zipfs_literal_tcl_library, -1); } #endif /* _WIN32 */ diff --git a/unix/Makefile.in b/unix/Makefile.in index 15d80cb..f885f5a 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1523,7 +1523,6 @@ tclZipfs.o: $(GENERIC_DIR)/tclZipfs.c $(CC) -c $(CC_SWITCHES) \ -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ -DCFG_RUNTIME_LIBDIR="\"$(libdir)\"" \ - -DCFG_RUNTIME_BINDIR="\"$(bindir)\"" \ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip \ $(GENERIC_DIR)/tclZipfs.c diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 203a118..d72913b 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -45,7 +45,7 @@ TclpFindExecutable( char name[PATH_MAX * 3 + 1]; GetModuleFileNameW(NULL, buf, PATH_MAX); - cygwin_conv_path(3, buf, name, PATH_MAX); + cygwin_conv_path(3, buf, name, sizeof(name)); length = strlen(name); if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { /* Strip '.exe' part. */ |
