Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "desktopdllapi.h"
22 : #include "dp_misc.h"
23 : #include "unopkg_main.h"
24 : #include "unopkg_shared.h"
25 : #include "dp_identifier.hxx"
26 : #include <tools/extendapplicationenvironment.hxx>
27 : #include <rtl/ustrbuf.hxx>
28 : #include <rtl/uri.hxx>
29 : #include <rtl/bootstrap.hxx>
30 : #include <osl/thread.h>
31 : #include <osl/process.h>
32 : #include <osl/conditn.hxx>
33 : #include <osl/file.hxx>
34 : #include <cppuhelper/implbase1.hxx>
35 : #include <cppuhelper/exc_hlp.hxx>
36 : #include <comphelper/anytostring.hxx>
37 : #include <comphelper/sequence.hxx>
38 : #include <com/sun/star/deployment/ExtensionManager.hpp>
39 :
40 : #include <com/sun/star/deployment/ui/PackageManagerDialog.hpp>
41 : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
42 : #include <boost/scoped_array.hpp>
43 : #include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
44 : #include <com/sun/star/bridge/BridgeFactory.hpp>
45 : #include <stdio.h>
46 : #include <vector>
47 :
48 :
49 : using namespace ::com::sun::star;
50 : using namespace ::com::sun::star::uno;
51 : using namespace ::unopkg;
52 : namespace {
53 :
54 0 : struct ExtensionName
55 : {
56 : OUString m_str;
57 0 : ExtensionName( OUString const & str ) : m_str( str ) {}
58 0 : bool operator () ( Reference<deployment::XPackage> const & e ) const
59 : {
60 0 : if (m_str.equals(dp_misc::getIdentifier(e))
61 0 : || m_str.equals(e->getName()))
62 0 : return true;
63 0 : return false;
64 : }
65 : };
66 :
67 :
68 : const char s_usingText [] =
69 : "\n"
70 : "using: " APP_NAME " add <options> extension-path...\n"
71 : " " APP_NAME " validate <options> extension-identifier...\n"
72 : " " APP_NAME " remove <options> extension-identifier...\n"
73 : " " APP_NAME " list <options> extension-identifier...\n"
74 : " " APP_NAME " reinstall <options>\n"
75 : " " APP_NAME " gui\n"
76 : " " APP_NAME " -V\n"
77 : " " APP_NAME " -h\n"
78 : "\n"
79 : "sub-commands:\n"
80 : " add add extension\n"
81 : " validate checks the prerequisites of an installed extension and"
82 : " registers it if possible\n"
83 : " remove remove extensions by identifier\n"
84 : " reinstall expert feature: reinstall all deployed extensions\n"
85 : " list list information about deployed extensions\n"
86 : " gui raise Extension Manager Graphical User Interface (GUI)\n"
87 : "\n"
88 : "options:\n"
89 : " -h, --help this help\n"
90 : " -V, --version version information\n"
91 : " -v, --verbose verbose output to stdout\n"
92 : " -f, --force force overwriting existing extensions\n"
93 : " -s, --suppress-license prevents showing the license\n"
94 : " --log-file <file> custom log file; default: <cache-dir>/log.txt\n"
95 : " --shared expert feature: operate on shared installation\n"
96 : " deployment context;\n"
97 : " run only when no concurrent Office\n"
98 : " process(es) are running!\n"
99 : " --bundled expert feature: operate on bundled extensions. Only\n"
100 : " works with list, validate, reinstall;\n"
101 : " --deployment-context expert feature: explicit deployment context\n"
102 : " <context>\n"
103 : "\n"
104 : "To learn more about the Extension Manager and extensions, see:\n"
105 : "http://wiki.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions\n\n";
106 :
107 :
108 : const OptionInfo s_option_infos [] = {
109 : { RTL_CONSTASCII_STRINGPARAM("help"), 'h', false },
110 : { RTL_CONSTASCII_STRINGPARAM("version"), 'V', false },
111 : { RTL_CONSTASCII_STRINGPARAM("verbose"), 'v', false },
112 : { RTL_CONSTASCII_STRINGPARAM("force"), 'f', false },
113 : { RTL_CONSTASCII_STRINGPARAM("log-file"), '\0', true },
114 : { RTL_CONSTASCII_STRINGPARAM("shared"), '\0', false },
115 : { RTL_CONSTASCII_STRINGPARAM("deployment-context"), '\0', true },
116 : { RTL_CONSTASCII_STRINGPARAM("bundled"), '\0', false},
117 : { RTL_CONSTASCII_STRINGPARAM("suppress-license"), 's', false},
118 :
119 : { 0, 0, '\0', false }
120 : };
121 :
122 0 : class DialogClosedListenerImpl :
123 : public ::cppu::WeakImplHelper1< ui::dialogs::XDialogClosedListener >
124 : {
125 : osl::Condition & m_rDialogClosedCondition;
126 :
127 : public:
128 0 : DialogClosedListenerImpl( osl::Condition & rDialogClosedCondition )
129 0 : : m_rDialogClosedCondition( rDialogClosedCondition ) {}
130 :
131 : // XEventListener (base of XDialogClosedListener)
132 : virtual void SAL_CALL disposing( lang::EventObject const & Source )
133 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : // XDialogClosedListener
136 : virtual void SAL_CALL dialogClosed(
137 : ui::dialogs::DialogClosedEvent const & aEvent )
138 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
139 : };
140 :
141 : // XEventListener (base of XDialogClosedListener)
142 0 : void DialogClosedListenerImpl::disposing( lang::EventObject const & )
143 : throw (RuntimeException, std::exception)
144 : {
145 : // nothing to do
146 0 : }
147 :
148 : // XDialogClosedListener
149 0 : void DialogClosedListenerImpl::dialogClosed(
150 : ui::dialogs::DialogClosedEvent const & )
151 : throw (RuntimeException, std::exception)
152 : {
153 0 : m_rDialogClosedCondition.set();
154 0 : }
155 :
156 : // If a package had been installed with a pre OOo 2.2, it could not normally be
157 : // found via its identifier; similarly (and for ease of use), a package
158 : // installed with OOo 2.2 or later could not normally be found via its file
159 : // name.
160 0 : Reference<deployment::XPackage> findPackage(
161 : OUString const & repository,
162 : Reference<deployment::XExtensionManager> const & manager,
163 : Reference<ucb::XCommandEnvironment > const & environment,
164 : OUString const & idOrFileName )
165 : {
166 : Sequence< Reference<deployment::XPackage> > ps(
167 0 : manager->getDeployedExtensions(repository,
168 0 : Reference<task::XAbortChannel>(), environment ) );
169 0 : for ( sal_Int32 i = 0; i < ps.getLength(); ++i )
170 0 : if ( dp_misc::getIdentifier( ps[i] ) == idOrFileName )
171 0 : return ps[i];
172 0 : for ( sal_Int32 i = 0; i < ps.getLength(); ++i )
173 0 : if ( ps[i]->getName() == idOrFileName )
174 0 : return ps[i];
175 0 : return Reference<deployment::XPackage>();
176 : }
177 :
178 : } // anon namespace
179 :
180 0 : extern "C" DESKTOP_DLLPUBLIC int unopkg_main()
181 : {
182 0 : tools::extendApplicationEnvironment();
183 0 : bool bNoOtherErrorMsg = false;
184 0 : OUString subCommand;
185 0 : bool option_shared = false;
186 0 : bool option_force = false;
187 0 : bool option_verbose = false;
188 0 : bool option_bundled = false;
189 0 : bool option_suppressLicense = false;
190 0 : bool subcmd_add = false;
191 0 : bool subcmd_gui = false;
192 0 : OUString logFile;
193 0 : OUString repository;
194 0 : OUString cmdArg;
195 0 : ::std::vector<OUString> cmdPackages;
196 :
197 : OptionInfo const * info_shared = getOptionInfo(
198 0 : s_option_infos, "shared" );
199 : OptionInfo const * info_force = getOptionInfo(
200 0 : s_option_infos, "force" );
201 : OptionInfo const * info_verbose = getOptionInfo(
202 0 : s_option_infos, "verbose" );
203 : OptionInfo const * info_log = getOptionInfo(
204 0 : s_option_infos, "log-file" );
205 : OptionInfo const * info_context = getOptionInfo(
206 0 : s_option_infos, "deployment-context" );
207 : OptionInfo const * info_help = getOptionInfo(
208 0 : s_option_infos, "help" );
209 : OptionInfo const * info_version = getOptionInfo(
210 0 : s_option_infos, "version" );
211 : OptionInfo const * info_bundled = getOptionInfo(
212 0 : s_option_infos, "bundled" );
213 : OptionInfo const * info_suppressLicense = getOptionInfo(
214 0 : s_option_infos, "suppress-license" );
215 :
216 :
217 0 : Reference<XComponentContext> xComponentContext;
218 0 : Reference<XComponentContext> xLocalComponentContext;
219 :
220 : try {
221 0 : sal_uInt32 nPos = 0;
222 0 : sal_uInt32 nCount = osl_getCommandArgCount();
223 0 : if (nCount == 0 || isOption( info_help, &nPos ))
224 : {
225 0 : dp_misc::writeConsole(s_usingText);
226 0 : return 0;
227 : }
228 0 : else if (isOption( info_version, &nPos )) {
229 0 : dp_misc::writeConsole("\n" APP_NAME " Version 3.3\n");
230 0 : return 0;
231 : }
232 : //consume all bootstrap variables which may occur before the subcommannd
233 0 : while(isBootstrapVariable(&nPos))
234 : ;
235 :
236 0 : if(nPos >= nCount)
237 0 : return 0;
238 : //get the sub command
239 0 : osl_getCommandArg( nPos, &subCommand.pData );
240 0 : ++nPos;
241 0 : subCommand = subCommand.trim();
242 0 : subcmd_add = subCommand == "add";
243 0 : subcmd_gui = subCommand == "gui";
244 :
245 : // sun-command options and packages:
246 0 : while (nPos < nCount)
247 : {
248 0 : if (readArgument( &cmdArg, info_log, &nPos )) {
249 0 : logFile = makeAbsoluteFileUrl(
250 0 : cmdArg.trim(), getProcessWorkingDir() );
251 : }
252 0 : else if (!readOption( &option_verbose, info_verbose, &nPos ) &&
253 0 : !readOption( &option_shared, info_shared, &nPos ) &&
254 0 : !readOption( &option_force, info_force, &nPos ) &&
255 0 : !readOption( &option_bundled, info_bundled, &nPos ) &&
256 0 : !readOption( &option_suppressLicense, info_suppressLicense, &nPos ) &&
257 0 : !readArgument( &repository, info_context, &nPos ) &&
258 0 : !isBootstrapVariable(&nPos))
259 : {
260 0 : osl_getCommandArg( nPos, &cmdArg.pData );
261 0 : ++nPos;
262 0 : cmdArg = cmdArg.trim();
263 0 : if (!cmdArg.isEmpty())
264 : {
265 0 : if (cmdArg[ 0 ] == '-')
266 : {
267 : // is option:
268 : dp_misc::writeConsoleError(
269 0 : "\nERROR: unexpected option " +
270 0 : cmdArg +
271 0 : "!\n Use " APP_NAME " " +
272 0 : toString(info_help) +
273 0 : " to print all options.\n");
274 0 : return 1;
275 : }
276 : else
277 : {
278 : // is package:
279 : cmdPackages.push_back(
280 0 : subcmd_add || subcmd_gui
281 : ? makeAbsoluteFileUrl(
282 0 : cmdArg, getProcessWorkingDir() )
283 0 : : cmdArg );
284 : }
285 : }
286 : }
287 : }
288 :
289 0 : if (repository.isEmpty())
290 : {
291 0 : if (option_shared)
292 0 : repository = "shared";
293 0 : else if (option_bundled)
294 0 : repository = "bundled";
295 : else
296 0 : repository = "user";
297 : }
298 : else
299 : {
300 0 : if ( repository == "shared" ) {
301 0 : option_shared = true;
302 : }
303 0 : else if (option_shared) {
304 : dp_misc::writeConsoleError(
305 0 : OUString("WARNING: explicit context given! ") +
306 0 : "Ignoring option " + toString( info_shared ) + "!\n" );
307 : }
308 : }
309 :
310 0 : if (subCommand == "reinstall")
311 : {
312 : //We must prevent that services and types are loaded by UNO,
313 : //otherwise we cannot delete the registry data folder.
314 0 : OUString extensionUnorc;
315 0 : if (repository == "user")
316 0 : extensionUnorc = "$UNO_USER_PACKAGES_CACHE/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc";
317 0 : else if (repository == "shared")
318 0 : extensionUnorc = "$SHARED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc";
319 0 : else if (repository == "bundled")
320 0 : extensionUnorc = "$BUNDLED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc";
321 : else
322 : OSL_ASSERT(false);
323 :
324 0 : ::rtl::Bootstrap::expandMacros(extensionUnorc);
325 0 : oslFileError e = osl_removeFile(extensionUnorc.pData);
326 0 : if (e != osl_File_E_None && e != osl_File_E_NOENT)
327 0 : throw Exception("Could not delete " + extensionUnorc, 0);
328 : }
329 :
330 0 : xComponentContext = getUNO(
331 0 : option_verbose, option_shared, subcmd_gui, xLocalComponentContext );
332 :
333 : Reference<deployment::XExtensionManager> xExtensionManager(
334 0 : deployment::ExtensionManager::get( xComponentContext ) );
335 :
336 : Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv(
337 : createCmdEnv( xComponentContext, logFile,
338 0 : option_force, option_verbose, option_suppressLicense) );
339 :
340 : //synchronize bundled/shared extensions
341 : //Do not synchronize when command is "reinstall". This could add types and services to UNO and
342 : //prevent the deletion of the registry data folder
343 : //synching is done in XExtensionManager.reinstall
344 0 : if (!subcmd_gui && ! (subCommand == "reinstall")
345 0 : && ! dp_misc::office_is_running())
346 0 : dp_misc::syncRepositories(false, xCmdEnv);
347 :
348 0 : if ( subcmd_add || subCommand == "remove" )
349 : {
350 0 : for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos )
351 : {
352 0 : OUString const & cmdPackage = cmdPackages[ pos ];
353 0 : if (subcmd_add)
354 : {
355 : beans::NamedValue nvSuppress(
356 : OUString("SUPPRESS_LICENSE"), option_suppressLicense ?
357 0 : makeAny(OUString("1")):makeAny(OUString("0")));
358 0 : xExtensionManager->addExtension(
359 : cmdPackage, Sequence<beans::NamedValue>(&nvSuppress, 1),
360 0 : repository, Reference<task::XAbortChannel>(), xCmdEnv);
361 : }
362 : else
363 : {
364 : try
365 : {
366 0 : xExtensionManager->removeExtension(
367 : cmdPackage, cmdPackage, repository,
368 0 : Reference<task::XAbortChannel>(), xCmdEnv );
369 : }
370 0 : catch (const lang::IllegalArgumentException &)
371 : {
372 : Reference<deployment::XPackage> p(
373 : findPackage(repository,
374 0 : xExtensionManager, xCmdEnv, cmdPackage ) );
375 0 : if ( !p.is())
376 0 : throw;
377 0 : else if (p.is())
378 0 : xExtensionManager->removeExtension(
379 0 : ::dp_misc::getIdentifier(p), p->getName(),
380 : repository,
381 0 : Reference<task::XAbortChannel>(), xCmdEnv );
382 : }
383 : }
384 : }
385 : }
386 0 : else if ( subCommand == "reinstall" )
387 : {
388 0 : xExtensionManager->reinstallDeployedExtensions(
389 0 : false, repository, Reference<task::XAbortChannel>(), xCmdEnv);
390 : }
391 0 : else if ( subCommand == "list" )
392 : {
393 0 : ::std::vector<Reference<deployment::XPackage> > vecExtUnaccepted;
394 : ::comphelper::sequenceToContainer(vecExtUnaccepted,
395 0 : xExtensionManager->getExtensionsWithUnacceptedLicenses(
396 0 : repository, xCmdEnv));
397 :
398 : //This vector tells what XPackage in allExtensions has an
399 : //unaccepted license.
400 0 : std::vector<bool> vecUnaccepted;
401 0 : std::vector<Reference<deployment::XPackage> > allExtensions;
402 0 : if (cmdPackages.empty())
403 : {
404 : Sequence< Reference<deployment::XPackage> >
405 0 : packages = xExtensionManager->getDeployedExtensions(
406 0 : repository, Reference<task::XAbortChannel>(), xCmdEnv );
407 :
408 0 : ::std::vector<Reference<deployment::XPackage> > vec_packages;
409 0 : ::comphelper::sequenceToContainer(vec_packages, packages);
410 :
411 : //First copy the extensions with the unaccepted license
412 : //to vector allExtensions.
413 0 : allExtensions.resize(vecExtUnaccepted.size() + vec_packages.size());
414 :
415 : ::std::vector<Reference<deployment::XPackage> >::iterator i_all_ext =
416 : ::std::copy(vecExtUnaccepted.begin(), vecExtUnaccepted.end(),
417 0 : allExtensions.begin());
418 : //Now copy those we got from getDeployedExtensions
419 0 : ::std::copy(vec_packages.begin(), vec_packages.end(), i_all_ext);
420 :
421 : //Now prepare the vector which tells what extension has an
422 : //unaccepted license
423 0 : vecUnaccepted.resize(vecExtUnaccepted.size() + vec_packages.size());
424 0 : ::std::fill_n(vecUnaccepted.begin(), vecExtUnaccepted.size(), true);
425 0 : ::std::fill_n(vecUnaccepted.begin() + vecExtUnaccepted.size(),
426 0 : vec_packages.size(), false);
427 :
428 : dp_misc::writeConsole(
429 0 : OUString("All deployed ") + repository + " extensions:\n\n");
430 : }
431 : else
432 : {
433 : //The user provided the names (ids or file names) of the extensions
434 : //which shall be listed
435 0 : for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos )
436 : {
437 0 : Reference<deployment::XPackage> extension;
438 : try
439 : {
440 0 : extension = xExtensionManager->getDeployedExtension(
441 0 : repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv );
442 : }
443 0 : catch (const lang::IllegalArgumentException &)
444 : {
445 0 : extension = findPackage(repository,
446 0 : xExtensionManager, xCmdEnv, cmdPackages[ pos ] );
447 : }
448 :
449 : //Now look if the requested extension has an unaccepted license
450 0 : bool bUnacceptedLic = false;
451 0 : if (!extension.is())
452 : {
453 : ::std::vector<Reference<deployment::XPackage> >::const_iterator
454 : i = ::std::find_if(
455 : vecExtUnaccepted.begin(),
456 0 : vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos]));
457 0 : if (i != vecExtUnaccepted.end())
458 : {
459 0 : extension = *i;
460 0 : bUnacceptedLic = true;
461 : }
462 : }
463 :
464 0 : if (extension.is())
465 : {
466 0 : allExtensions.push_back(extension);
467 0 : vecUnaccepted.push_back(bUnacceptedLic);
468 : }
469 :
470 : else
471 : throw lang::IllegalArgumentException(
472 0 : "There is no such extension deployed: " +
473 0 : cmdPackages[pos],0,-1);
474 0 : }
475 :
476 : }
477 :
478 0 : printf_packages(allExtensions, vecUnaccepted, xCmdEnv );
479 : }
480 0 : else if ( subCommand == "validate" )
481 : {
482 0 : ::std::vector<Reference<deployment::XPackage> > vecExtUnaccepted;
483 : ::comphelper::sequenceToContainer(
484 0 : vecExtUnaccepted, xExtensionManager->getExtensionsWithUnacceptedLicenses(
485 0 : repository, xCmdEnv));
486 :
487 0 : for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos )
488 : {
489 0 : Reference<deployment::XPackage> extension;
490 : try
491 : {
492 0 : extension = xExtensionManager->getDeployedExtension(
493 0 : repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv );
494 : }
495 0 : catch (const lang::IllegalArgumentException &)
496 : {
497 0 : extension = findPackage(
498 0 : repository, xExtensionManager, xCmdEnv, cmdPackages[ pos ] );
499 : }
500 :
501 0 : if (!extension.is())
502 : {
503 : ::std::vector<Reference<deployment::XPackage> >::const_iterator
504 : i = ::std::find_if(
505 : vecExtUnaccepted.begin(),
506 0 : vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos]));
507 0 : if (i != vecExtUnaccepted.end())
508 : {
509 0 : extension = *i;
510 : }
511 : }
512 :
513 0 : if (extension.is())
514 0 : xExtensionManager->checkPrerequisitesAndEnable(
515 0 : extension, Reference<task::XAbortChannel>(), xCmdEnv);
516 0 : }
517 : }
518 0 : else if ( subCommand == "gui" )
519 : {
520 : Reference<ui::dialogs::XAsynchronousExecutableDialog> xDialog(
521 : deployment::ui::PackageManagerDialog::createAndInstall(
522 : xComponentContext,
523 0 : cmdPackages.size() > 0 ? cmdPackages[0] : OUString() ));
524 :
525 0 : osl::Condition dialogEnded;
526 0 : dialogEnded.reset();
527 :
528 : Reference< ui::dialogs::XDialogClosedListener > xListener(
529 0 : new DialogClosedListenerImpl( dialogEnded ) );
530 :
531 0 : xDialog->startExecuteModal(xListener);
532 0 : dialogEnded.wait();
533 0 : return 0;
534 : }
535 : else
536 : {
537 : dp_misc::writeConsoleError(
538 0 : "\nERROR: unknown sub-command " +
539 0 : subCommand + "!\n Use " APP_NAME " " +
540 0 : toString(info_help) + " to print all options.\n");
541 0 : return 1;
542 : }
543 :
544 0 : if (option_verbose)
545 0 : dp_misc::writeConsole("\n" APP_NAME " done.\n");
546 : //Force to release all bridges which connect us to the child processes
547 0 : dp_misc::disposeBridges(xLocalComponentContext);
548 0 : return 0;
549 : }
550 0 : catch (const ucb::CommandFailedException &e)
551 : {
552 0 : dp_misc::writeConsoleError(e.Message + "\n");
553 0 : bNoOtherErrorMsg = true;
554 : }
555 0 : catch (const ucb::CommandAbortedException &)
556 : {
557 0 : dp_misc::writeConsoleError("\n" APP_NAME " aborted!\n");
558 : }
559 0 : catch (const deployment::DeploymentException & exc)
560 : {
561 0 : OUString cause;
562 0 : if (option_verbose)
563 : {
564 0 : cause = ::comphelper::anyToString(exc.Cause);
565 : }
566 : else
567 : {
568 0 : css::uno::Exception e;
569 0 : if (exc.Cause >>= e)
570 0 : cause = e.Message;
571 : }
572 :
573 0 : dp_misc::writeConsoleError("\nERROR: " + exc.Message + "\n");
574 0 : if (!cause.isEmpty())
575 0 : dp_misc::writeConsoleError(" Cause: " + cause + "\n");
576 : }
577 0 : catch (const LockFileException & e)
578 : {
579 0 : if (!subcmd_gui)
580 0 : dp_misc::writeConsoleError(e.Message);
581 0 : bNoOtherErrorMsg = true;
582 : }
583 0 : catch (const ::com::sun::star::uno::Exception & e ) {
584 0 : Any exc( ::cppu::getCaughtException() );
585 :
586 0 : dp_misc::writeConsoleError("\nERROR: " +
587 0 : OUString(option_verbose ? e.Message + "\nException details: \n" +
588 0 : ::comphelper::anyToString(exc) : e.Message) + "\n");
589 : }
590 0 : if (!bNoOtherErrorMsg)
591 0 : dp_misc::writeConsoleError("\n" APP_NAME " failed.\n");
592 0 : dp_misc::disposeBridges(xLocalComponentContext);
593 0 : return 1;
594 : }
595 :
596 :
597 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|