1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_SALHELPER_LINKHELPER_HXX
11 #define INCLUDED_SALHELPER_LINKHELPER_HXX
13 #include "rtl/ustring.hxx"
14 #include "osl/file.hxx"
18 class SAL_WARN_UNUSED LinkResolver
21 osl::FileStatus m_aStatus
;
23 LinkResolver(sal_uInt32 nMask
)
25 osl_FileStatus_Mask_FileURL
|
26 osl_FileStatus_Mask_Type
|
27 osl_FileStatus_Mask_LinkTargetURL
)
31 /** Resolve a file url if it's a symbolic link, to a maximum depth of
32 * nDepth and fill in m_aStatus with the requested ctor flags
34 * @return osl::FileBase::E_None on success
36 * @see DirectoryItem::getFileStatus
38 osl::FileBase::RC
fetchFileStatus(const rtl::OUString
&rURL
,
41 //In an ideal world this wouldn't be inline, but I want to use this
42 //in jvmfwk hence salhelper, but salhelper is .map controlled and
43 //getting all the mangled names right is a misery, moving it over
44 //to visibility markup would drop per-symbol versioning
45 osl::FileBase::RC eReturn
;
47 osl::DirectoryItem item
;
48 rtl::OUString
sURL(rURL
);
49 while ((eReturn
= osl::DirectoryItem::get(sURL
, item
))
54 eReturn
= osl::FileBase::E_MULTIHOP
;
57 eReturn
= item
.getFileStatus(m_aStatus
);
58 if (eReturn
!= osl::File::E_None
)
60 if (m_aStatus
.getFileType() != osl::FileStatus::Link
)
62 eReturn
= osl::FileBase::E_None
;
65 sURL
= m_aStatus
.getLinkTargetURL();
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */