xref: /trunk/main/sal/osl/os2/file_path_helper.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir  /*******************************************
29*cdf0e10cSrcweir     Includes
30*cdf0e10cSrcweir   ******************************************/
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir  #ifndef _OSL_THREAD_H_
33*cdf0e10cSrcweir  #include "osl/thread.h"
34*cdf0e10cSrcweir  #endif
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir  #ifndef _OSL_FILE_PATH_HELPER_H_
37*cdf0e10cSrcweir  #include "file_path_helper.h"
38*cdf0e10cSrcweir  #endif
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir  #ifndef _OSL_FILE_PATH_HELPER_HXX_
41*cdf0e10cSrcweir  #include "file_path_helper.hxx"
42*cdf0e10cSrcweir  #endif
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir  #ifndef _OSL_UUNXAPI_HXX_
45*cdf0e10cSrcweir  #include "uunxapi.hxx"
46*cdf0e10cSrcweir  #endif
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir  #ifndef _OSL_DIAGNOSE_H_
49*cdf0e10cSrcweir  #include <osl/diagnose.h>
50*cdf0e10cSrcweir  #endif
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir  #ifndef _RTL_USTRING_HXX_
53*cdf0e10cSrcweir  #include <rtl/ustring.hxx>
54*cdf0e10cSrcweir  #endif
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir  /*******************************************
57*cdf0e10cSrcweir     Constants
58*cdf0e10cSrcweir   ******************************************/
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir   const sal_Unicode FPH_CHAR_PATH_SEPARATOR = (sal_Unicode)'\\';
61*cdf0e10cSrcweir   const sal_Unicode FPH_CHAR_DOT            = (sal_Unicode)'.';
62*cdf0e10cSrcweir   const sal_Unicode FPH_CHAR_COLON          = (sal_Unicode)':';
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir   inline const rtl::OUString FPH_PATH_SEPARATOR()
65*cdf0e10cSrcweir       { return rtl::OUString::createFromAscii("\\"); }
66*cdf0e10cSrcweir   inline const rtl::OUString FPH_LOCAL_DIR_ENTRY()
67*cdf0e10cSrcweir       { return rtl::OUString::createFromAscii("."); }
68*cdf0e10cSrcweir   inline const rtl::OUString FPH_PARENT_DIR_ENTRY()
69*cdf0e10cSrcweir       { return rtl::OUString::createFromAscii(".."); }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir  /*******************************************
72*cdf0e10cSrcweir   *  osl_systemPathRemoveSeparator
73*cdf0e10cSrcweir   ******************************************/
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir  void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath)
76*cdf0e10cSrcweir  {
77*cdf0e10cSrcweir     OSL_PRECOND(pustrPath, "osl_systemPathRemoveSeparator: Invalid parameter");
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     // maybe there are more than one separator at end
80*cdf0e10cSrcweir     // so we run in a loop
81*cdf0e10cSrcweir     while ((pustrPath->length > 1) && (FPH_CHAR_PATH_SEPARATOR == pustrPath->buffer[pustrPath->length - 1]))
82*cdf0e10cSrcweir     {
83*cdf0e10cSrcweir         pustrPath->length--;
84*cdf0e10cSrcweir         pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0';
85*cdf0e10cSrcweir     }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     OSL_POSTCOND((0 == pustrPath->length) || (1 == pustrPath->length) || \
88*cdf0e10cSrcweir                  (pustrPath->length > 1 && pustrPath->buffer[pustrPath->length - 1] != FPH_CHAR_PATH_SEPARATOR), \
89*cdf0e10cSrcweir                  "osl_systemPathRemoveSeparator: Post condition failed");
90*cdf0e10cSrcweir  }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir  /*******************************************
93*cdf0e10cSrcweir     osl_systemPathEnsureSeparator
94*cdf0e10cSrcweir   ******************************************/
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir  void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath)
97*cdf0e10cSrcweir  {
98*cdf0e10cSrcweir     OSL_PRECOND(ppustrPath && (NULL != *ppustrPath), \
99*cdf0e10cSrcweir                 "osl_systemPathEnsureSeparator: Invalid parameter");
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir     rtl::OUString path(*ppustrPath);
102*cdf0e10cSrcweir     sal_Int32     lp = path.getLength();
103*cdf0e10cSrcweir     sal_Int32     i  = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0))
106*cdf0e10cSrcweir     {
107*cdf0e10cSrcweir         path += FPH_PATH_SEPARATOR();
108*cdf0e10cSrcweir         rtl_uString_assign(ppustrPath, path.pData);
109*cdf0e10cSrcweir     }
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir     OSL_POSTCOND(path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR) == (path.getLength() - 1), \
112*cdf0e10cSrcweir                  "osl_systemPathEnsureSeparator: Post condition failed");
113*cdf0e10cSrcweir  }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir  /*******************************************
116*cdf0e10cSrcweir   *  osl_systemPathIsRelativePath
117*cdf0e10cSrcweir   ******************************************/
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir  sal_Bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath)
120*cdf0e10cSrcweir  {
121*cdf0e10cSrcweir     OSL_PRECOND(pustrPath, "osl_systemPathIsRelativePath: Invalid parameter");
122*cdf0e10cSrcweir     return (!osl_systemPathIsAbsolutePath(pustrPath));
123*cdf0e10cSrcweir  }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir  /******************************************
126*cdf0e10cSrcweir   *  osl_systemPathIsAbsolutePath
127*cdf0e10cSrcweir   *****************************************/
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir  sal_Bool SAL_CALL osl_systemPathIsAbsolutePath(const rtl_uString* pustrPath)
130*cdf0e10cSrcweir  {
131*cdf0e10cSrcweir     OSL_PRECOND(pustrPath, "osl_systemPathIsAbsolutePath: Invalid parameter");
132*cdf0e10cSrcweir     if (pustrPath->length == 0)
133*cdf0e10cSrcweir         return sal_False;
134*cdf0e10cSrcweir     if (pustrPath->buffer[0] == FPH_CHAR_PATH_SEPARATOR)
135*cdf0e10cSrcweir         return sal_True;
136*cdf0e10cSrcweir     if (pustrPath->buffer[1] == FPH_CHAR_COLON
137*cdf0e10cSrcweir             && pustrPath->buffer[2] == FPH_CHAR_PATH_SEPARATOR)
138*cdf0e10cSrcweir         return sal_True;
139*cdf0e10cSrcweir     return sal_False;
140*cdf0e10cSrcweir  }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir  /******************************************
143*cdf0e10cSrcweir     osl_systemPathMakeAbsolutePath
144*cdf0e10cSrcweir   *****************************************/
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir  void SAL_CALL osl_systemPathMakeAbsolutePath(
147*cdf0e10cSrcweir     const rtl_uString* pustrBasePath,
148*cdf0e10cSrcweir     const rtl_uString* pustrRelPath,
149*cdf0e10cSrcweir     rtl_uString**      ppustrAbsolutePath)
150*cdf0e10cSrcweir {
151*cdf0e10cSrcweir     rtl::OUString base(rtl_uString_getStr(const_cast<rtl_uString*>(pustrBasePath)));
152*cdf0e10cSrcweir     rtl::OUString rel(const_cast<rtl_uString*>(pustrRelPath));
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir     if (base.getLength() > 0)
155*cdf0e10cSrcweir         osl_systemPathEnsureSeparator(&base.pData);
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     base += rel;
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     rtl_uString_acquire(base.pData);
160*cdf0e10cSrcweir     *ppustrAbsolutePath = base.pData;
161*cdf0e10cSrcweir }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir  /*****************************************
165*cdf0e10cSrcweir     osl_systemPathGetParent
166*cdf0e10cSrcweir   ****************************************/
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir  sal_Int32 SAL_CALL osl_systemPathGetParent(rtl_uString* pustrPath)
169*cdf0e10cSrcweir  {
170*cdf0e10cSrcweir     return 0;
171*cdf0e10cSrcweir  }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir  /*******************************************
174*cdf0e10cSrcweir     osl_systemPathGetFileOrLastDirectoryPart
175*cdf0e10cSrcweir   ******************************************/
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir  void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
178*cdf0e10cSrcweir     const rtl_uString*  pustrPath,
179*cdf0e10cSrcweir     rtl_uString**       ppustrFileNameOrLastDirPart)
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir     OSL_PRECOND(pustrPath && ppustrFileNameOrLastDirPart, \
182*cdf0e10cSrcweir                 "osl_systemPathGetFileNameOrLastDirectoryPart: Invalid parameter");
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     rtl::OUString path(const_cast<rtl_uString*>(pustrPath));
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     osl_systemPathRemoveSeparator(path.pData);
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir     rtl::OUString last_part;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     if (path.getLength() > 1 || (1 == path.getLength() && *path.getStr() != FPH_CHAR_PATH_SEPARATOR))
191*cdf0e10cSrcweir     {
192*cdf0e10cSrcweir         sal_Int32 idx_ps = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
193*cdf0e10cSrcweir         idx_ps++; // always right to increment by one even if idx_ps == -1!
194*cdf0e10cSrcweir         last_part = rtl::OUString(path.getStr() + idx_ps);
195*cdf0e10cSrcweir     }
196*cdf0e10cSrcweir     rtl_uString_assign(ppustrFileNameOrLastDirPart, last_part.pData);
197*cdf0e10cSrcweir }
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir  /********************************************
201*cdf0e10cSrcweir     osl_systemPathIsHiddenFileOrDirectoryEntry
202*cdf0e10cSrcweir  *********************************************/
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir  sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
205*cdf0e10cSrcweir     const rtl_uString* pustrPath)
206*cdf0e10cSrcweir {
207*cdf0e10cSrcweir     OSL_PRECOND(pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter");
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir     sal_Bool is_hidden = sal_False;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     if (pustrPath->length > 0)
212*cdf0e10cSrcweir     {
213*cdf0e10cSrcweir         rtl::OUString fdp;
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir         osl_systemPathGetFileNameOrLastDirectoryPart(pustrPath, &fdp.pData);
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir         is_hidden = ((fdp.pData->length > 0) && (fdp.pData->buffer[0] == FPH_CHAR_DOT) &&
218*cdf0e10cSrcweir                      !osl_systemPathIsLocalOrParentDirectoryEntry(fdp.pData));
219*cdf0e10cSrcweir     }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     return is_hidden;
222*cdf0e10cSrcweir }
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir  /************************************************
226*cdf0e10cSrcweir     osl_systemPathIsLocalOrParentDirectoryEntry
227*cdf0e10cSrcweir  ************************************************/
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir sal_Bool SAL_CALL osl_systemPathIsLocalOrParentDirectoryEntry(
230*cdf0e10cSrcweir     const rtl_uString* pustrPath)
231*cdf0e10cSrcweir {
232*cdf0e10cSrcweir     OSL_PRECOND(pustrPath, "osl_systemPathIsLocalOrParentDirectoryEntry: Invalid parameter");
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir     rtl::OUString dirent;
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir     osl_systemPathGetFileNameOrLastDirectoryPart(pustrPath, &dirent.pData);
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     return (
239*cdf0e10cSrcweir             (dirent == FPH_LOCAL_DIR_ENTRY()) ||
240*cdf0e10cSrcweir             (dirent == FPH_PARENT_DIR_ENTRY())
241*cdf0e10cSrcweir            );
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir /***********************************************
245*cdf0e10cSrcweir  Simple iterator for a path list separated by
246*cdf0e10cSrcweir  the specified character
247*cdf0e10cSrcweir  **********************************************/
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir class path_list_iterator
250*cdf0e10cSrcweir {
251*cdf0e10cSrcweir public:
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     /******************************************
254*cdf0e10cSrcweir      constructor
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir      after construction get_current_item
257*cdf0e10cSrcweir      returns the first path in list, no need
258*cdf0e10cSrcweir      to call reset first
259*cdf0e10cSrcweir      *****************************************/
260*cdf0e10cSrcweir     path_list_iterator(const rtl::OUString& path_list, sal_Unicode list_separator = FPH_CHAR_COLON) :
261*cdf0e10cSrcweir         m_path_list(path_list),
262*cdf0e10cSrcweir         m_end(m_path_list.getStr() + m_path_list.getLength() + 1),
263*cdf0e10cSrcweir         m_separator(list_separator)
264*cdf0e10cSrcweir     {
265*cdf0e10cSrcweir         reset();
266*cdf0e10cSrcweir     }
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir     /******************************************
269*cdf0e10cSrcweir      reset the iterator
270*cdf0e10cSrcweir      *****************************************/
271*cdf0e10cSrcweir     void reset()
272*cdf0e10cSrcweir     {
273*cdf0e10cSrcweir         m_path_segment_begin = m_path_segment_end = m_path_list.getStr();
274*cdf0e10cSrcweir         advance();
275*cdf0e10cSrcweir     }
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir     /******************************************
278*cdf0e10cSrcweir      move the iterator to the next position
279*cdf0e10cSrcweir      *****************************************/
280*cdf0e10cSrcweir     void next()
281*cdf0e10cSrcweir     {
282*cdf0e10cSrcweir         OSL_PRECOND(!done(), "path_list_iterator: Already done!");
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir         m_path_segment_begin = ++m_path_segment_end;
285*cdf0e10cSrcweir         advance();
286*cdf0e10cSrcweir     }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir     /******************************************
289*cdf0e10cSrcweir      check if done
290*cdf0e10cSrcweir      *****************************************/
291*cdf0e10cSrcweir     bool done() const
292*cdf0e10cSrcweir     {
293*cdf0e10cSrcweir         return (m_path_segment_end >= m_end);
294*cdf0e10cSrcweir     }
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     /******************************************
297*cdf0e10cSrcweir      return the current item
298*cdf0e10cSrcweir      *****************************************/
299*cdf0e10cSrcweir     rtl::OUString get_current_item() const
300*cdf0e10cSrcweir     {
301*cdf0e10cSrcweir         return rtl::OUString(
302*cdf0e10cSrcweir             m_path_segment_begin,
303*cdf0e10cSrcweir             (m_path_segment_end - m_path_segment_begin));
304*cdf0e10cSrcweir     }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir private:
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir     /******************************************
309*cdf0e10cSrcweir      move m_path_end to the next separator or
310*cdf0e10cSrcweir      to the edn of the string
311*cdf0e10cSrcweir      *****************************************/
312*cdf0e10cSrcweir     void advance()
313*cdf0e10cSrcweir     {
314*cdf0e10cSrcweir         while (!done() && *m_path_segment_end && (*m_path_segment_end != m_separator))
315*cdf0e10cSrcweir             ++m_path_segment_end;
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir         OSL_ASSERT(m_path_segment_end <= m_end);
318*cdf0e10cSrcweir     }
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir private:
321*cdf0e10cSrcweir     rtl::OUString       m_path_list;
322*cdf0e10cSrcweir     const sal_Unicode*  m_end;
323*cdf0e10cSrcweir     const sal_Unicode   m_separator;
324*cdf0e10cSrcweir     const sal_Unicode*  m_path_segment_begin;
325*cdf0e10cSrcweir     const sal_Unicode*  m_path_segment_end;
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir // prevent copy and assignment
328*cdf0e10cSrcweir private:
329*cdf0e10cSrcweir     /******************************************
330*cdf0e10cSrcweir      copy constructor
331*cdf0e10cSrcweir      remember: do not simply copy m_path_begin
332*cdf0e10cSrcweir      and m_path_end because they point to
333*cdf0e10cSrcweir      the memory of other.m_path_list!
334*cdf0e10cSrcweir      *****************************************/
335*cdf0e10cSrcweir     path_list_iterator(const path_list_iterator& other);
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     /******************************************
338*cdf0e10cSrcweir      assignment operator
339*cdf0e10cSrcweir      remember: do not simply copy m_path_begin
340*cdf0e10cSrcweir      and m_path_end because they point to
341*cdf0e10cSrcweir      the memory of other.m_path_list!
342*cdf0e10cSrcweir      *****************************************/
343*cdf0e10cSrcweir     path_list_iterator& operator=(const path_list_iterator& other);
344*cdf0e10cSrcweir };
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir  /************************************************
347*cdf0e10cSrcweir     osl_searchPath
348*cdf0e10cSrcweir   ***********************************************/
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir sal_Bool SAL_CALL osl_searchPath(
351*cdf0e10cSrcweir     const rtl_uString* pustrFilePath,
352*cdf0e10cSrcweir     const rtl_uString* pustrSearchPathList,
353*cdf0e10cSrcweir     rtl_uString**      ppustrPathFound)
354*cdf0e10cSrcweir {
355*cdf0e10cSrcweir     OSL_PRECOND(pustrFilePath && pustrSearchPathList && ppustrPathFound, "osl_searchPath: Invalid parameter");
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir     bool               bfound = false;
358*cdf0e10cSrcweir     rtl::OUString      fp(const_cast<rtl_uString*>(pustrFilePath));
359*cdf0e10cSrcweir     rtl::OUString      pl = rtl::OUString(const_cast<rtl_uString*>(pustrSearchPathList));
360*cdf0e10cSrcweir     path_list_iterator pli(pl);
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir     while (!pli.done())
363*cdf0e10cSrcweir     {
364*cdf0e10cSrcweir         rtl::OUString p = pli.get_current_item();
365*cdf0e10cSrcweir         osl::systemPathEnsureSeparator(p);
366*cdf0e10cSrcweir         p += fp;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir         if (osl::access(p, F_OK) > -1)
369*cdf0e10cSrcweir         {
370*cdf0e10cSrcweir             bfound = true;
371*cdf0e10cSrcweir             rtl_uString_assign(ppustrPathFound, p.pData);
372*cdf0e10cSrcweir             break;
373*cdf0e10cSrcweir         }
374*cdf0e10cSrcweir         pli.next();
375*cdf0e10cSrcweir     }
376*cdf0e10cSrcweir     return bfound;
377*cdf0e10cSrcweir }
378