summaryrefslogtreecommitdiff
path: root/desktop/source/deployment/dp_persmap.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-11-16 16:59:39 +0000
committerMichael Meeks <michael.meeks@suse.com>2011-11-16 17:04:54 +0000
commit042247b3e428cb7352c06a670576819c67378090 (patch)
tree7faec906f90ec86a67a1bdf925ca6b6490086f4f /desktop/source/deployment/dp_persmap.cxx
parent6beeefab7698e86eb7864196a35c232ff84625fa (diff)
Fixup legacy sleepycat db database usage for packages
Previously empty legacy registered_packages.db databases were created unconditionally, at some efficiency and startup cost, despite these being deprectated since before version 3.2. We now handle version mismatches by warning on the console and ignoring these files.
Diffstat (limited to 'desktop/source/deployment/dp_persmap.cxx')
-rw-r--r--desktop/source/deployment/dp_persmap.cxx27
1 files changed, 6 insertions, 21 deletions
diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx
index 92e4080063f9..c09bb9b9d5d8 100644
--- a/desktop/source/deployment/dp_persmap.cxx
+++ b/desktop/source/deployment/dp_persmap.cxx
@@ -79,35 +79,20 @@ PersistentMap::~PersistentMap()
}
//______________________________________________________________________________
-PersistentMap::PersistentMap( OUString const & url_, bool readOnly )
+PersistentMap::PersistentMap( OUString const & url )
: m_db( 0, 0 )
{
try {
- OUString url( expandUnoRcUrl(url_) );
- if ( File::getSystemPathFromFileURL( url, m_sysPath ) != File::E_None )
- {
+ rtl::OUString fileURL = expandUnoRcUrl(url);
+ if ( File::getSystemPathFromFileURL( fileURL, m_sysPath ) != File::E_None )
OSL_ASSERT( false );
- }
+
OString cstr_sysPath(
OUStringToOString( m_sysPath, RTL_TEXTENCODING_UTF8 ) );
- char const * pcstr_sysPath = cstr_sysPath.getStr();
-
- u_int32_t flags = DB_CREATE;
- if (readOnly) {
- flags = DB_RDONLY;
- if (! create_ucb_content(
- 0, url,
- Reference<com::sun::star::ucb::XCommandEnvironment>(),
- false /* no throw */ )) {
- // ignore non-existent file in read-only mode: simulate empty db
- pcstr_sysPath = 0;
- flags = DB_CREATE;
- }
- }
-
int err = m_db.open(
// xxx todo: DB_THREAD, DB_DBT_MALLOC currently not used
- 0, pcstr_sysPath, 0, DB_HASH, flags/* | DB_THREAD*/, 0664 /* fs mode */ );
+ 0, cstr_sysPath.getStr(), 0, DB_HASH,
+ DB_CREATE/* | DB_THREAD*/, 0664 /* fs mode */ );
if (err != 0)
throw_rtexc(err);
}