25#include <osl/file.hxx>
26#include <com/sun/star/uno/XComponentContext.hpp>
37 #define sSourceUserBasic "/user/basic"
38 #define sTargetUserBasic "/user/__basic_80"
57 ::osl::Directory aDir( rBaseURL);
59 if ( aDir.open() == ::osl::FileBase::E_None )
63 ::osl::DirectoryItem aItem;
64 while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None )
66 ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL );
67 if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None )
69 if ( aFileStatus.getFileType() == ::osl::FileStatus::Directory )
70 aSubDirs.push_back( aFileStatus.getFileURL() );
72 aResult->push_back( aFileStatus.getFileURL() );
77 for (
auto const& subDir : aSubDirs)
80 aResult->insert( aResult->end(), aSubResult->begin(), aSubResult->end() );
91 if ( aResult == ::osl::FileBase::E_NOENT )
109 for (
auto const& elem : *aFileList)
111 std::u16string_view sLocalName = elem.subView(
m_sSourceDir.getLength() );
112 OUString sTargetName = sTargetDir + sLocalName;
114 aURL.removeSegment();
116 ::osl::FileBase::RC aResult = ::osl::File::copy( elem, sTargetName );
117 if ( aResult != ::osl::FileBase::E_None )
119 SAL_WARN(
"desktop",
"BasicMigration::copyFiles: cannot copy "
120 << elem <<
" to " << sTargetName );
126 OSL_FAIL(
"BasicMigration::copyFiles: no user installation!" );
136 return "com.sun.star.comp.desktop.migration.Basic";
148 return {
"com.sun.star.migration.Basic" };
157 ::osl::MutexGuard aGuard(
m_aMutex );
161 for ( ; pIter != pEnd ; ++pIter )
163 beans::NamedValue aValue;
165 if ( aValue.Name ==
"UserData" )
169 OSL_FAIL(
"BasicMigration::initialize: argument UserData has wrong type!" );
183 ::osl::MutexGuard aGuard(
m_aMutex );
193extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
195 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * desktop_BasicMigration_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool removeSegment(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true)
virtual ~BasicMigration() override
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
TStringVectorPtr getFiles(const OUString &rBaseURL) const
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &Arguments) override
void checkAndCreateDirectory(INetURLObject const &rDirURL)
static PathStatus locateUserInstallation(OUString &_rURL)
Sequence< PropertyValue > aArguments
#define SAL_WARN(area, stream)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
std::vector< OUString > TStringVector
std::unique_ptr< TStringVector > TStringVectorPtr