summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-08-27 14:35:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-08-27 14:42:24 +0100
commit68dea1c1b61a99cdef556ba7d8ccfdad1be8a663 (patch)
tree8a342345b1bb1d948b95fbd1b98d80b9fef44234 /unotools
parent8763c77c39507284d45eb79c29977eb0174b66f1 (diff)
Resolves: fdo#67743 ensure user autocorr config dir exists
We try and copy the shared one to the user location the first time we create a customized user file. If the dir doesn't exist then that migration doesn't happen. The new autocorr file is then written, creating the dir, and any further operations will reattempt the skipped share copy, and this time succeed because the dir now exists. Which overwrites the previously written customized content. This is similar to fdo#65501 "ensure configured backup dir exists before using it", so reuse that code and move it into unotools. Change-Id: I38fa621b8d7295d70b09172a028569ea95404120
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index efa9e4690603..97cc3c75c928 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -42,6 +42,7 @@
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/util/DateTime.hpp"
#include "comphelper/processfactory.hxx"
#include "cppuhelper/exc_hlp.hxx"
@@ -453,4 +454,23 @@ bool utl::UCBContentHelper::EqualURLs(
== 0;
}
+bool utl::UCBContentHelper::ensureFolder(
+ css::uno::Reference< css::uno::XComponentContext > xCtx,
+ css::uno::Reference< css::ucb::XCommandEnvironment > xEnv,
+ const OUString& rFolder, ucbhelper::Content & result)
+{
+ INetURLObject aURL( rFolder );
+ OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
+ aURL.removeSegment();
+ ::ucbhelper::Content aParent;
+
+ if ( ::ucbhelper::Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ),
+ xEnv, xCtx, aParent ) )
+ {
+ return ::utl::UCBContentHelper::MakeFolder(aParent, aTitle, result);
+ }
+
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */