Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
124a29f0
Kaydet (Commit)
124a29f0
authored
Eki 10, 2014
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move the removeTree function from desktop to unotools
Change-Id: I98d3f4a68abfee42dac987633878b850134671d3
üst
3d85ec29
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
52 deletions
+56
-52
app.cxx
desktop/source/app/app.cxx
+2
-52
localfilehelper.hxx
include/unotools/localfilehelper.hxx
+3
-0
localfilehelper.cxx
unotools/source/ucbhelper/localfilehelper.cxx
+51
-0
No files found.
desktop/source/app/app.cxx
Dosyayı görüntüle @
124a29f0
...
...
@@ -81,6 +81,7 @@
#include <unotools/bootstrap.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/moduleoptions.hxx>
#include <unotools/localfilehelper.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Office/Recovery.hxx>
#include <officecfg/Setup.hxx>
...
...
@@ -163,57 +164,6 @@ namespace {
#if HAVE_FEATURE_EXTENSIONS
void
removeTree
(
OUString
const
&
url
)
{
osl
::
Directory
dir
(
url
);
osl
::
FileBase
::
RC
rc
=
dir
.
open
();
switch
(
rc
)
{
case
osl
:
:
FileBase
::
E_None
:
break
;
case
osl
:
:
FileBase
::
E_NOENT
:
return
;
//TODO: SAL_WARN if recursive
default
:
SAL_WARN
(
"desktop.app"
,
"cannot open directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
return
;
}
for
(;;)
{
osl
::
DirectoryItem
i
;
rc
=
dir
.
getNextItem
(
i
,
SAL_MAX_UINT32
);
if
(
rc
==
osl
::
FileBase
::
E_NOENT
)
{
break
;
}
if
(
rc
!=
osl
::
FileBase
::
E_None
)
{
SAL_WARN
(
"desktop.app"
,
"cannot iterate directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
break
;
}
osl
::
FileStatus
stat
(
osl_FileStatus_Mask_Type
|
osl_FileStatus_Mask_FileName
|
osl_FileStatus_Mask_FileURL
);
rc
=
i
.
getFileStatus
(
stat
);
if
(
rc
!=
osl
::
FileBase
::
E_None
)
{
SAL_WARN
(
"desktop.app"
,
"cannot stat in directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
continue
;
}
if
(
stat
.
getFileType
()
==
osl
::
FileStatus
::
Directory
)
{
//TODO: symlinks
removeTree
(
stat
.
getFileURL
());
}
else
{
rc
=
osl
::
File
::
remove
(
stat
.
getFileURL
());
SAL_WARN_IF
(
rc
!=
osl
::
FileBase
::
E_None
,
"desktop.app"
,
"cannot remove file "
<<
stat
.
getFileURL
()
<<
": "
<<
+
rc
);
}
}
if
(
dir
.
isOpen
())
{
rc
=
dir
.
close
();
SAL_WARN_IF
(
rc
!=
osl
::
FileBase
::
E_None
,
"desktop.app"
,
"cannot close directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
}
rc
=
osl
::
Directory
::
remove
(
url
);
SAL_WARN_IF
(
rc
!=
osl
::
FileBase
::
E_None
,
"desktop.app"
,
"cannot remove directory "
<<
url
<<
": "
<<
+
rc
);
}
// Remove any existing UserInstallation's extensions cache data remaining from
// old installations. This addresses at least two problems:
//
...
...
@@ -285,7 +235,7 @@ bool cleanExtensionCache() {
SAL_WARN
(
"desktop.app"
,
"cannot open "
<<
fr
.
getURL
()
<<
" for reading: "
<<
+
rc
);
break
;
}
removeTree
(
extDir
);
utl
::
removeTree
(
extDir
);
OUString
userRcFile
(
"$UNO_USER_PACKAGES_CACHE/registry/"
"com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc"
);
...
...
include/unotools/localfilehelper.hxx
Dosyayı görüntüle @
124a29f0
...
...
@@ -52,6 +52,9 @@ namespace utl
static
::
com
::
sun
::
star
::
uno
::
Sequence
<
OUString
>
GetFolderContents
(
const
OUString
&
rFolder
,
bool
bFolder
);
};
/// recursively remove directory and all contents
UNOTOOLS_DLLPUBLIC
void
removeTree
(
OUString
const
&
url
);
}
#endif
...
...
unotools/source/ucbhelper/localfilehelper.cxx
Dosyayı görüntüle @
124a29f0
...
...
@@ -193,6 +193,57 @@ typedef ::std::vector< OUString* > StringList_Impl;
return
Sequence
<
OUString
>
();
}
void
removeTree
(
OUString
const
&
url
)
{
osl
::
Directory
dir
(
url
);
osl
::
FileBase
::
RC
rc
=
dir
.
open
();
switch
(
rc
)
{
case
osl
:
:
FileBase
::
E_None
:
break
;
case
osl
:
:
FileBase
::
E_NOENT
:
return
;
//TODO: SAL_WARN if recursive
default
:
SAL_WARN
(
"desktop.app"
,
"cannot open directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
return
;
}
for
(;;)
{
osl
::
DirectoryItem
i
;
rc
=
dir
.
getNextItem
(
i
,
SAL_MAX_UINT32
);
if
(
rc
==
osl
::
FileBase
::
E_NOENT
)
{
break
;
}
if
(
rc
!=
osl
::
FileBase
::
E_None
)
{
SAL_WARN
(
"desktop.app"
,
"cannot iterate directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
break
;
}
osl
::
FileStatus
stat
(
osl_FileStatus_Mask_Type
|
osl_FileStatus_Mask_FileName
|
osl_FileStatus_Mask_FileURL
);
rc
=
i
.
getFileStatus
(
stat
);
if
(
rc
!=
osl
::
FileBase
::
E_None
)
{
SAL_WARN
(
"desktop.app"
,
"cannot stat in directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
continue
;
}
if
(
stat
.
getFileType
()
==
osl
::
FileStatus
::
Directory
)
{
//TODO: symlinks
removeTree
(
stat
.
getFileURL
());
}
else
{
rc
=
osl
::
File
::
remove
(
stat
.
getFileURL
());
SAL_WARN_IF
(
rc
!=
osl
::
FileBase
::
E_None
,
"desktop.app"
,
"cannot remove file "
<<
stat
.
getFileURL
()
<<
": "
<<
+
rc
);
}
}
if
(
dir
.
isOpen
())
{
rc
=
dir
.
close
();
SAL_WARN_IF
(
rc
!=
osl
::
FileBase
::
E_None
,
"desktop.app"
,
"cannot close directory "
<<
dir
.
getURL
()
<<
": "
<<
+
rc
);
}
rc
=
osl
::
Directory
::
remove
(
url
);
SAL_WARN_IF
(
rc
!=
osl
::
FileBase
::
E_None
,
"desktop.app"
,
"cannot remove directory "
<<
url
<<
": "
<<
+
rc
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment