[PATCH 1 of 5] (issue54) Add parameter handling to desktopshellrun
Wald Commits
scm-commit at wald.intevation.org
Wed Sep 17 12:14:14 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410948650 -7200
# Node ID 4a17c9f977d07676096d53fd7043d697f259180c
# Parent a162f4cbba75a966595bcaee3e7cdce0d3981436
(issue54) Add parameter handling to desktopshellrun
diff -r a162f4cbba75 -r 4a17c9f977d0 packaging/desktopshellrun.cpp
--- a/packaging/desktopshellrun.cpp Wed Sep 17 10:57:54 2014 +0200
+++ b/packaging/desktopshellrun.cpp Wed Sep 17 12:10:50 2014 +0200
@@ -75,11 +75,12 @@
*
* @param[in] disp The shell dispatcher to use for shell execute.
* @param[in] fName The file that should be exectued.
+ * @param[in] param Optinal parameters to add.
*
* @returns true on success.
*/
static bool
-shellexecute(IShellDispatch2 *disp, wchar_t *fName)
+shellexecute(IShellDispatch2 *disp, wchar_t *fName, wchar_t *param)
{
BSTR bName = NULL,
bParam = NULL,
@@ -95,7 +96,7 @@
}
bName = SysAllocString(fName);
- bParam = SysAllocString(L"");
+ bParam = SysAllocString(param ? param : L"");
bDir = SysAllocString(L"");
bOp = SysAllocString(L"");
@@ -163,7 +164,8 @@
UNUSED(hwndParent);
UNUSED(string_size);
HRESULT hr;
- wchar_t *wbuf = NULL;
+ wchar_t *wbuf = NULL,
+ *params = NULL;
IShellWindows *shellWindows = NULL;
IShellBrowser *shellBrowser = NULL;
IShellView *shellView = NULL;
@@ -278,11 +280,17 @@
goto done;
}
- if (!shellexecute(shellDispatch, wbuf))
+ if ((*stacktop)->next && (*stacktop)->next->text)
+ {
+ params = utf8_to_wchar((*stacktop)->next->text, strlen((*stacktop)->next->text));
+ }
+
+ if (!shellexecute(shellDispatch, wbuf, params))
{
ERRORPRINTF ("Failed to execute.");
}
xfree (wbuf);
+ xfree (params);
done:
if (folderView)
{
More information about the Trustbridge-commits
mailing list