summaryrefslogtreecommitdiff
path: root/win/packaging/ca/CustomAction.cpp
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-02-04 14:50:25 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-02-04 14:50:25 +0100
commit4fb2cb1a30fc188682ae4dbda2f975213e5c3adf (patch)
tree522b2dc8096cc37ace66686de36b486b73a352f5 /win/packaging/ca/CustomAction.cpp
parentc0f5fd27549c84607defa64c5b651343dd29e0ee (diff)
parent9ed8deb656d9378fc9c1c7fb12c15674b6323ab0 (diff)
downloadmariadb-git-4fb2cb1a30fc188682ae4dbda2f975213e5c3adf.tar.gz
Merge branch '10.7' into 10.8
Diffstat (limited to 'win/packaging/ca/CustomAction.cpp')
-rw-r--r--win/packaging/ca/CustomAction.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp
index cbef4d2ee41..328e73accb8 100644
--- a/win/packaging/ca/CustomAction.cpp
+++ b/win/packaging/ca/CustomAction.cpp
@@ -187,6 +187,27 @@ bool IsDirectoryEmptyOrNonExisting(const wchar_t *dir) {
return empty;
}
+extern "C" UINT __stdcall CheckInstallDirectory(MSIHANDLE hInstall)
+{
+ HRESULT hr= S_OK;
+ UINT er= ERROR_SUCCESS;
+ wchar_t *path= 0;
+
+ hr= WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaGetFormattedString(L"[INSTALLDIR]", &path);
+ if (!IsDirectoryEmptyOrNonExisting(path))
+ {
+ wchar_t msg[2*MAX_PATH];
+ swprintf(msg,countof(msg), L"Installation directory '%s' exists and is not empty. Choose a "
+ "different install directory",path);
+ WcaSetProperty(L"INSTALLDIRERROR", msg);
+ }
+LExit:
+ ReleaseStr(path);
+ return WcaFinalize(er);
+}
+
/*
Check for valid data directory is empty during install
A valid data directory is non-existing, or empty.