[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-windows
Subject: Re: Problem with ksycoca on windows
From: Ralf Habacker <ralf.habacker () freenet ! de>
Date: 2008-02-14 19:17:27
Message-ID: 47B493C7.5060400 () freenet ! de
[Download RAW message or body]
Christian Ehrlicher schrieb:
> Hi,
>
> I've a problem on windows - when ksycoca is running / the db is open, I
> can't execute kbuildsycoca to update the db. The problem is that
> kbuildsycoca can't overwrite an open file on windows.
> There're two solutions
> - let kbuildsycoca create ksyscoca.new and rename the file when db is closed
> - open the file in a special mode so I can delete it also someone has an
> open file handle on it. But for this I can't use QFile and I don't know
> if it really works like it should.
>
Appended is a patch which loaded the ksycoca database complete into
memory and close the file, so that kbuildsycoca can update the file
without problems.
Any objectivies ?
>
> Any ideas?
> Christian
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Kde-windows mailing list
> Kde-windows@kde.org
> https://mail.kde.org/mailman/listinfo/kde-windows
>
["ksycoca-in-memory.patch" (text/plain)]
Index: ksycoca.cpp
===================================================================
--- ksycoca.cpp (revision 774546)
+++ ksycoca.cpp (working copy)
@@ -36,6 +36,10 @@
#include <stdlib.h>
#include <fcntl.h>
+#ifdef Q_OS_WIN
+#undef HAVE_MMAP
+#endif
+
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
@@ -181,7 +185,12 @@
{
kDebug(7011) << "mmap failed. (length = " << sycoca_size << ")";
#endif
+#ifdef Q_OS_WIN
+ m_str = new QDataStream( m_database->readAll());
+ m_database->close();
+#else
m_str = new QDataStream(m_database);
+#endif
m_str->setVersion(QDataStream::Qt_3_1);
sycoca_mmap = 0;
#ifdef HAVE_MMAP
@@ -264,8 +273,10 @@
{
QDataStream* &m_str = KSycocaPrivate::_self->m_str;
QIODevice *device = 0;
+#ifndef Q_OS_WIN
if (m_str)
device = m_str->device();
+#endif
#ifdef HAVE_MMAP
if (device && sycoca_mmap)
{
_______________________________________________
Kde-windows mailing list
Kde-windows@kde.org
https://mail.kde.org/mailman/listinfo/kde-windows
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic