diff options
author | Joachim Lingner <jl@openoffice.org> | 2010-07-22 14:10:02 +0200 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2010-07-22 14:10:02 +0200 |
commit | 6fc85e3c5c85d0fc2e5e9f9516bcce8b8eaf94a6 (patch) | |
tree | 84505f49d2d6aae4b1f5aeef090c4ec7138558bd /desktop | |
parent | 4713f8bcaf05fcec0111542f5a658b963c43139b (diff) |
jl154 #i162868# unopkg sync now removes the folder when it does no contain a folder
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 42 | ||||
-rw-r--r-- | desktop/source/app/userinstall.cxx | 6 | ||||
-rw-r--r-- | desktop/source/app/userinstall.hxx | 2 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_app.cxx | 5 |
4 files changed, 19 insertions, 36 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 3ab5c6cacc88..ace2149036c9 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -469,8 +469,6 @@ void ReplaceStringHookProc( UniString& rStr ) } } -static const char pPresetsFolder[] = "presets"; -static const char pBundledFolder[] = BUNDLED_FOLDER_NAME; static const char pLastSyncFileName[] = "lastsynchronized"; static const sal_Int32 nStrLenLastSync = 16; @@ -537,25 +535,13 @@ static bool needsSynchronization( return bNeedsSync; } -static ::rtl::OUString getBasePresetsPathURL() +static ::rtl::OUString getBrandSharePreregBundledPathURL() { - ::rtl::OUString aBaseInstallURL; - ::utl::Bootstrap::PathStatus aBaseInstallStatus = ::utl::Bootstrap::locateBaseInstallation( aBaseInstallURL ); + ::rtl::OUString url( + RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/share/prereg/bundled")); - if ( aBaseInstallStatus == ::utl::Bootstrap::PATH_EXISTS ) - { - ::rtl::OUStringBuffer aTmp( aBaseInstallURL ); - ::sal_Int32 nLastIndex = aBaseInstallURL.lastIndexOf('/'); - - if ( nLastIndex != aBaseInstallURL.getLength()-1 ) - aTmp.appendAscii( "/" ); - aTmp.appendAscii( pPresetsFolder ); - aTmp.appendAscii( "/" ); - aTmp.appendAscii( pBundledFolder ); - aBaseInstallURL = aTmp.makeStringAndClear(); - } - - return aBaseInstallURL; + ::rtl::Bootstrap::expandMacros(url); + return url; } static ::rtl::OUString getUserBundledExtPathURL() @@ -566,14 +552,14 @@ static ::rtl::OUString getUserBundledExtPathURL() return folder; } -static ::rtl::OUString getLastSyncFileURLFromBaseInstallation() +static ::rtl::OUString getLastSyncFileURLFromBrandInstallation() { - ::rtl::OUString aBasePresetPathURL = getBasePresetsPathURL(); - ::sal_Int32 nLastIndex = aBasePresetPathURL.lastIndexOf('/'); + ::rtl::OUString aURL = getBrandSharePreregBundledPathURL(); + ::sal_Int32 nLastIndex = aURL.lastIndexOf('/'); - ::rtl::OUStringBuffer aTmp( aBasePresetPathURL ); + ::rtl::OUStringBuffer aTmp( aURL ); - if ( nLastIndex != aBasePresetPathURL.getLength()-1 ) + if ( nLastIndex != aURL.getLength()-1 ) aTmp.appendAscii( "/" ); aTmp.appendAscii( pLastSyncFileName ); @@ -692,17 +678,17 @@ void Desktop::Init() // and test if synchronzation is necessary! { ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation(); - ::rtl::OUString aBaseLastSyncFilePathURL = getLastSyncFileURLFromBaseInstallation(); + ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation(); - if ( needsSynchronization( aBaseLastSyncFilePathURL, aUserLastSyncFilePathURL )) + if ( needsSynchronization( aPreregSyncFilePathURL, aUserLastSyncFilePathURL )) { rtl::OUString aUserPath = getUserBundledExtPathURL(); - rtl::OUString aBasePresetsBundledPath = getBasePresetsPathURL(); + rtl::OUString aPreregBundledPath = getBrandSharePreregBundledPathURL(); // copy bundled folder to the user directory osl::FileBase::RC rc = osl::Directory::createPath(aUserPath); (void) rc; - copy_bundled_recursive( aBasePresetsBundledPath, aUserPath, +1 ); + copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 ); } } diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx index 0a31bed791ec..546a6f0ad13c 100644 --- a/desktop/source/app/userinstall.cxx +++ b/desktop/source/app/userinstall.cxx @@ -207,12 +207,8 @@ namespace desktop { if (newDstUnqPath.lastIndexOf(sal_Unicode('/')) != newDstUnqPath.getLength()-1) newDstUnqPath += rtl::OUString::createFromAscii("/"); newDstUnqPath += itemname; - // recursion - // Filer out bundled folder which is treated by a special - // implementation. - if ( !itemname.equalsAscii( BUNDLED_FOLDER_NAME )) - err = copy_recursive(newSrcUnqPath, newDstUnqPath); + err = copy_recursive(newSrcUnqPath, newDstUnqPath); } aDir.close(); diff --git a/desktop/source/app/userinstall.hxx b/desktop/source/app/userinstall.hxx index 8a8740eaa28b..8d6a51cd66be 100644 --- a/desktop/source/app/userinstall.hxx +++ b/desktop/source/app/userinstall.hxx @@ -29,8 +29,6 @@ #include <sal/types.h> #include <rtl/ustring.hxx> -#define BUNDLED_FOLDER_NAME "bundled" - namespace desktop { diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 9115cd32cbd4..4545ed862271 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -394,8 +394,11 @@ extern "C" int unopkg_main() //then we can delete the registration data at //$BUNDLED_EXTENSIONS_USER if (hasNoFolder(OUSTR("$BRAND_BASE_DIR/share/extensions"))) + { removeFolder(OUSTR("$BUNDLED_EXTENSIONS_USER")); - return 0; + //return otherwise we create the registration data again + return 0; + } } |