[PATCH setup 2/2] Rename Start Menu folder for 32-bit installs on WoW64
Jon Turney
jon.turney@dronecode.org.uk
Thu Mar 19 13:52:23 GMT 2020
This is not totally straightforward: Since setup can install Cygwin with
either bitness (using the '--arch 32|64' option), we must do the right
thing if this is a 64-bit installer being used to install 32-bit Cygwin,
which will run under WoW, even if the installer isn't...
(Naming things like this makes things consistent with Cygwin-X, which
already names it's Start Menu folder 'Cygwin-X (32-bit)' on WoW64. It
also ensures that there aren't collisions between any setup created
shortcuts for 32-bit and 64-bits.)
The desktop icon is already named 'Cygwin Terminal' or 'Cygwin64
Terminal' so doesn't need attention.
Start menu links made in the 'Cygwin' folder by cygwin-doc, and possibly
other packages will also need adjusting.
---
desktop.cc | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/desktop.cc b/desktop.cc
index eec8ca9..29dbf63 100644
--- a/desktop.cc
+++ b/desktop.cc
@@ -95,6 +95,14 @@ make_link (const std::string& linkpath,
icon.c_str(), fname.c_str());
}
+static const char *startmenudir()
+{
+ if (!is_64bit && (WowNativeMachine() != IMAGE_FILE_MACHINE_I386))
+ return "/Cygwin (32-bit)";
+ else
+ return "/Cygwin";
+}
+
static void
start_menu (const std::string& title, const std::string& target,
const std::string& arg, const std::string& iconpath)
@@ -107,7 +115,7 @@ start_menu (const std::string& title, const std::string& target,
issystem ? CSIDL_COMMON_PROGRAMS :
CSIDL_PROGRAMS, &id);
SHGetPathFromIDList (id, path);
- strncat (path, "/Cygwin", MAX_PATH - strlen(path) - 1);
+ strncat (path, startmenudir(), MAX_PATH - strlen(path) - 1);
LogBabblePrintf ("Program directory for program link: %s", path);
make_link (path, title, target, arg, iconpath);
}
@@ -194,7 +202,6 @@ save_icon (std::string &iconpath, const char *resource_name)
#define TERMINALICON "/Cygwin-Terminal.ico"
#define TERMINALTITLE (is_64bit ? "Cygwin64 Terminal" \
: "Cygwin Terminal")
-#define STARTMENUDIR "/Cygwin"
static void
do_desktop_setup ()
@@ -300,7 +307,7 @@ check_startmenu (const std::string title, const std::string target)
CSIDL_PROGRAMS, &id);
SHGetPathFromIDList (id, path);
LogBabblePrintf ("Program directory for program link: %s", path);
- strcat (path, STARTMENUDIR);
+ strcat (path, startmenudir());
std::string fname = std::string(path) + "/" + title + ".lnk";
if (_access (fname.c_str(), 0) == 0)
--
2.21.0
More information about the Cygwin-apps
mailing list