Be prepared for a case-insensitive file system on Linux, too, not just macOS
Can easily happen at least on WSL.
Also avoid warnings about the deprecated readdir_r(). In current
POSIX, readdir() is required to be thread-safe. (It might well have
been for a long time in those POSIXish platforms we care for, I don't
know.)
Change-Id: I2b89b7aa170f661365580979d151c1b0557955fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197053
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
(cherry picked from commit fa8e80f065)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206957
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
This commit is contained in:
committed by
Christian Lohmaier
parent
eb04445c1f
commit
4bb53fcd55
@@ -25,7 +25,7 @@
|
||||
#include "sourceprovider-scanner.hxx"
|
||||
#include "sourcetreeprovider.hxx"
|
||||
|
||||
#if defined MACOSX
|
||||
#if defined MACOSX || defined LINUX
|
||||
#include <dirent.h>
|
||||
#include <osl/thread.h>
|
||||
#endif
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
// original spelling of a file name (not even with
|
||||
// osl_FileStatus_Mask_Validate):
|
||||
OUString getFileName(OUString const & uri, osl::FileStatus const & status) {
|
||||
#if defined MACOSX
|
||||
#if defined MACOSX || defined LINUX
|
||||
sal_Int32 i = uri.lastIndexOf('/') + 1;
|
||||
OUString path;
|
||||
if (osl::FileBase::getSystemPathFromFileURL(uri.copy(0, i), path)
|
||||
@@ -59,7 +59,12 @@ OUString getFileName(OUString const & uri, osl::FileStatus const & status) {
|
||||
for (;;) {
|
||||
dirent ent;
|
||||
dirent * p;
|
||||
|
||||
// readdir_r() is deprecated in current POSIX
|
||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
||||
int e = readdir_r(d, &ent, &p);
|
||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
||||
|
||||
if (e != 0) {
|
||||
SAL_WARN("unoidl", "cannot readdir_r");
|
||||
closedir(d);
|
||||
|
||||
Reference in New Issue
Block a user