From 25c7d3fb2125f964fe5b9317b31de39117072150 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 27 Nov 2014 20:39:02 -0600 Subject: [PATCH] give a nice message when installer is launched w/o admin rights (closes #16561) --- PC/bdist_wininst/install.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index e9401d9f3f5..a0232d23c94 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -1774,6 +1774,16 @@ static BOOL OpenLogfile(char *dir) sprintf(buffer, "%s\\%s-wininst.log", dir, meta_name); logfile = fopen(buffer, "a"); + if (!logfile) { + char error[1024]; + + sprintf(error, "Can't create \"%s\" (%s).\n\n" + "Try to execute the installer as administrator.", + buffer, strerror(errno)); + MessageBox(GetFocus(), error, NULL, MB_OK | MB_ICONSTOP); + return FALSE; + } + time(<ime); now = localtime(<ime); strftime(buffer, sizeof(buffer),