[Libreoffice-commits] .: desktop/source

Michael Meeks michael at kemper.freedesktop.org
Mon Mar 12 06:18:38 PDT 2012


 desktop/source/deployment/manager/dp_manager.cxx |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 61eeb689d7605a23c3e71c652b57ee65cf5b28dc
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Mar 12 13:19:32 2012 +0000

    fix smoketest - need to check read-only-ness of non-existent paths

diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx
index 126aa04..80a9522 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -316,12 +316,19 @@ void PackageManagerImpl::initRegistryBackends()
 // as to whether a directory is truly read-only or not
 static bool isMacroURLReadOnly( const OUString &rMacro )
 {
-    rtl::OUString aURL( rMacro );
-    ::rtl::Bootstrap::expandMacros( aURL );
+    rtl::OUString aDirURL( rMacro );
+    ::rtl::Bootstrap::expandMacros( aDirURL );
+
+    ::osl::FileBase::RC aErr = ::osl::Directory::create( aDirURL );
+    if ( aErr == ::osl::FileBase::E_None )
+        return false; // it will be writeable
+    if ( aErr != ::osl::FileBase::E_EXIST )
+        return true; // some serious problem creating it
 
     bool bError;
     sal_uInt64 nWritten = 0;
-    ::osl::File aFile( aURL );
+    rtl::OUString aFileURL( aDirURL + "/stamp.sys" );
+    ::osl::File aFile( aFileURL );
 
     bError = aFile.open( osl_File_OpenFlag_Read |
                          osl_File_OpenFlag_Write |
@@ -330,12 +337,12 @@ static bool isMacroURLReadOnly( const OUString &rMacro )
         bError = aFile.write( "1", 1, nWritten ) != ::osl::FileBase::E_None;
     if (aFile.close() != ::osl::FileBase::E_None)
         bError = true;
-    if (osl::File::remove( aURL ) != ::osl::FileBase::E_None)
+    if (osl::File::remove( aFileURL ) != ::osl::FileBase::E_None)
         bError = true;
 
     SAL_INFO(
         "desktop.deployment",
-        "local url '" << rMacro << "' -> '" << aURL << "' "
+        "local url '" << rMacro << "' -> '" << aFileURL << "' "
             << (bError ? "is" : "is not") << " readonly\n");
     return bError;
 }
@@ -370,7 +377,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
         //using virtualization it appears that he/she can. Then a shared extension can
         //be installed but is only visible for the user (because the extension is in
         //the virtual store).
-        stamp = OUSTR("$UNO_USER_PACKAGES_CACHE/stamp.sys");
+        stamp = OUSTR("$UNO_USER_PACKAGES_CACHE");
     }
     else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) {
         that->m_activePackages = OUSTR(
@@ -381,7 +388,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
             "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/registry");
         logFile = OUSTR(
             "vnd.sun.star.expand:$SHARED_EXTENSIONS_USER/log.txt");
-        stamp = OUSTR("$UNO_SHARED_PACKAGES_CACHE/stamp.sys");
+        stamp = OUSTR("$UNO_SHARED_PACKAGES_CACHE");
     }
     else if (context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bundled") )) {
         that->m_activePackages = OUSTR(
@@ -420,7 +427,7 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create(
             "vnd.sun.star.expand:$TMP_EXTENSIONS");
         that->m_registryCache = OUSTR(
             "vnd.sun.star.expand:$TMP_EXTENSIONS/registry");
-        stamp = OUSTR("$TMP_EXTENSIONS/stamp.sys");
+        stamp = OUSTR("$TMP_EXTENSIONS");
     }
     else if (! context.matchAsciiL(
                  RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.tdoc:/") )) {


More information about the Libreoffice-commits mailing list