summaryrefslogtreecommitdiff
path: root/desktop/source/app/app.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/app/app.cxx')
-rw-r--r--desktop/source/app/app.cxx264
1 files changed, 0 insertions, 264 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index eaa8bbb00081..c0bc0edd938c 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -148,10 +148,6 @@ namespace desktop
static oslSignalHandler pSignalHandler = 0;
static sal_Bool _bCrashReporterEnabled = sal_True;
-#ifndef ANDROID
-static ::rtl::OUString getBrandSharePreregBundledPathURL();
-#endif
-
namespace {
void removeTree(OUString const & url) {
@@ -513,246 +509,6 @@ rtl::OUString ReplaceStringHookProc( const rtl::OUString& rStr )
return sRet;
}
-static const char pLastSyncFileName[] = "lastsynchronized";
-static const sal_Int32 nStrLenLastSync = 16;
-
-#ifndef ANDROID
-
-static bool needsSynchronization(
- ::rtl::OUString const & baseSynchronizedURL, ::rtl::OUString const & userSynchronizedURL )
-{
- bool bNeedsSync( false );
-
- ::osl::DirectoryItem itemUserFile;
- ::osl::File::RC err1 =
- ::osl::DirectoryItem::get(userSynchronizedURL, itemUserFile);
-
- //If it does not exist, then there is nothing to be done
- if (err1 == ::osl::File::E_NOENT)
- {
- return true;
- }
- else if (err1 != ::osl::File::E_None)
- {
- OSL_FAIL("Cannot access lastsynchronized in user layer");
- return true; //sync just in case
- }
-
- //If last synchronized does not exist in base layer, then do nothing
- ::osl::DirectoryItem itemBaseFile;
- ::osl::File::RC err2 = ::osl::DirectoryItem::get(baseSynchronizedURL, itemBaseFile);
- if (err2 == ::osl::File::E_NOENT)
- {
- return true;
-
- }
- else if (err2 != ::osl::File::E_None)
- {
- OSL_FAIL("Cannot access file lastsynchronized in base layer");
- return true; //sync just in case
- }
-
- //compare the modification time of the extension folder and the last
- //modified file
- ::osl::FileStatus statUser(osl_FileStatus_Mask_ModifyTime);
- ::osl::FileStatus statBase(osl_FileStatus_Mask_ModifyTime);
- if (itemUserFile.getFileStatus(statUser) == ::osl::File::E_None)
- {
- if (itemBaseFile.getFileStatus(statBase) == ::osl::File::E_None)
- {
- TimeValue timeUser = statUser.getModifyTime();
- TimeValue timeBase = statBase.getModifyTime();
-
- if (timeUser.Seconds < timeBase.Seconds)
- bNeedsSync = true;
- }
- else
- {
- OSL_ASSERT(0);
- bNeedsSync = true;
- }
- }
- else
- {
- OSL_ASSERT(0);
- bNeedsSync = true;
- }
-
- return bNeedsSync;
-}
-
-static ::rtl::OUString getBrandSharePreregBundledPathURL()
-{
- ::rtl::OUString url(
- "$BRAND_BASE_DIR/share/prereg/bundled");
-
- ::rtl::Bootstrap::expandMacros(url);
- return url;
-}
-
-static ::rtl::OUString getUserBundledExtPathURL()
-{
- ::rtl::OUString folder( "$BUNDLED_EXTENSIONS_USER" );
- ::rtl::Bootstrap::expandMacros(folder);
-
- return folder;
-}
-
-static ::rtl::OUString getLastSyncFileURLFromBrandInstallation()
-{
- ::rtl::OUString aURL = getBrandSharePreregBundledPathURL();
- ::sal_Int32 nLastIndex = aURL.lastIndexOf('/');
-
- ::rtl::OUStringBuffer aTmp( aURL );
-
- if ( nLastIndex != aURL.getLength()-1 )
- aTmp.appendAscii( "/" );
- aTmp.appendAscii( pLastSyncFileName );
-
- return aTmp.makeStringAndClear();
-}
-
-static ::rtl::OUString getLastSyncFileURLFromUserInstallation()
-{
- ::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL();
- ::sal_Int32 nLastIndex = aUserBundledPathURL.lastIndexOf('/');
-
- ::rtl::OUStringBuffer aTmp( aUserBundledPathURL );
-
- if ( nLastIndex != aUserBundledPathURL.getLength()-1 )
- aTmp.appendAscii( "/" );
- aTmp.appendAscii( pLastSyncFileName );
-
- return aTmp.makeStringAndClear();
-}
-
-#endif
-
-//Checks if the argument src is the folder of the help or configuration
-//backend in the prereg folder
-static bool excludeTmpFilesAndFolders(const rtl::OUString & src)
-{
- const char helpBackend[] = "com.sun.star.comp.deployment.help.PackageRegistryBackend";
- const char configBackend[] = "com.sun.star.comp.deployment.configuration.PackageRegistryBackend";
- if (src.endsWithAsciiL(helpBackend, sizeof(helpBackend) - 1 )
- || src.endsWithAsciiL(configBackend, sizeof(configBackend) - 1))
- {
- return true;
- }
- return false;
-}
-
-//If we are about to copy the contents of some special folder as determined
-//by excludeTmpFilesAndFolders, then we omit those files or folders with a name
-//derived from temporary folders.
-static bool isExcludedFileOrFolder( const rtl::OUString & name)
-{
- char const * allowed[] = {
- "backenddb.xml",
- "configmgr.ini",
- "registered_packages.db"
- };
-
- const unsigned int size = sizeof(allowed) / sizeof (char const *);
- bool bExclude = true;
- for (unsigned int i= 0; i < size; i ++)
- {
- ::rtl::OUString allowedName = ::rtl::OUString::createFromAscii(allowed[i]);
- if (allowedName.equals(name))
- {
- bExclude = false;
- break;
- }
- }
- return bExclude;
-}
-
-static osl::FileBase::RC copy_bundled_recursive(
- const rtl::OUString& srcUnqPath,
- const rtl::OUString& dstUnqPath,
- sal_Int32 TypeToCopy )
-throw()
-{
- osl::FileBase::RC err = osl::FileBase::E_None;
-
- if( TypeToCopy == -1 ) // Document
- {
- err = osl::File::copy( srcUnqPath,dstUnqPath );
- }
- else if( TypeToCopy == +1 ) // Folder
- {
- err = osl::Directory::create( dstUnqPath );
- osl::FileBase::RC next = err;
- if( err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST )
- {
- err = osl::FileBase::E_None;
-
- osl::Directory aDir( srcUnqPath );
- bool bExcludeFiles = excludeTmpFilesAndFolders(srcUnqPath);
- if (aDir.open() == osl::FileBase::E_None)
- {
- sal_Int32 n_Mask = osl_FileStatus_Mask_FileURL |
- osl_FileStatus_Mask_FileName |
- osl_FileStatus_Mask_Type;
-
- osl::DirectoryItem aDirItem;
- while( err == osl::FileBase::E_None && ( next = aDir.getNextItem( aDirItem ) ) == osl::FileBase::E_None )
- {
- sal_Bool IsDoc = false;
- sal_Bool bFilter = false;
- osl::FileStatus aFileStatus( n_Mask );
- aDirItem.getFileStatus( aFileStatus );
- if( aFileStatus.isValid( osl_FileStatus_Mask_Type ) )
- IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
-
- // Getting the information for the next recursive copy
- sal_Int32 newTypeToCopy = IsDoc ? -1 : +1;
-
- rtl::OUString newSrcUnqPath;
- if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
- newSrcUnqPath = aFileStatus.getFileURL();
-
- rtl::OUString newDstUnqPath = dstUnqPath;
- rtl::OUString tit;
- if( aFileStatus.isValid( osl_FileStatus_Mask_FileName ) )
- {
- ::rtl::OUString aFileName = aFileStatus.getFileName();
- tit = rtl::Uri::encode( aFileName,
- rtl_UriCharClassPchar,
- rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_UTF8 );
-
- // Special treatment for "lastsychronized" file. Must not be
- // copied from the bundled folder!
- //Also do not copy *.tmp files and *.tmp_ folders. This affects the files/folders
- //from the help and configuration backend
- if ( IsDoc && (aFileName.equalsAscii( pLastSyncFileName )
- || (bExcludeFiles && isExcludedFileOrFolder(aFileName))))
- bFilter = true;
- else if (!IsDoc && bExcludeFiles && isExcludedFileOrFolder(aFileName))
- bFilter = true;
- }
-
- if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 )
- newDstUnqPath += rtl::OUString("/");
-
- newDstUnqPath += tit;
-
- if (( newSrcUnqPath != dstUnqPath ) && !bFilter )
- err = copy_bundled_recursive( newSrcUnqPath,newDstUnqPath, newTypeToCopy );
- }
-
- if( err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT )
- err = next;
-
- aDir.close();
- }
- }
- }
-
- return err;
-}
-
Desktop::Desktop()
: m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK )
@@ -774,26 +530,6 @@ void Desktop::Init()
refreshBundledExtensionsDir();
- // Check for lastsynchronized file for bundled extensions in the user directory
- // and test if synchronzation is necessary!
-#ifndef ANDROID
- {
- ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation();
- ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation();
-
- if ( needsSynchronization( aPreregSyncFilePathURL, aUserLastSyncFilePathURL ))
- {
- rtl::OUString aUserPath = getUserBundledExtPathURL();
- rtl::OUString aPreregBundledPath = getBrandSharePreregBundledPathURL();
-
- // copy bundled folder to the user directory
- osl::FileBase::RC rc = osl::Directory::createPath(aUserPath);
- (void) rc;
- if (false) copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 );
- }
- }
-#endif
-
// We need to have service factory before going further, but see fdo#37195.
// Doing this will mmap common.rdb, making it not overwritable on windows,
// so this can't happen before the synchronization above. Lets rework this