LibreOffice Module unotools (master) 1
bootstrap.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <string_view>
23
24#include <config_folders.h>
25
27
28#include <rtl/ustring.hxx>
29#include <rtl/ustrbuf.hxx>
30#include <sal/log.hxx>
31#include <osl/file.hxx>
32#include <osl/diagnose.h>
33
34#include <rtl/bootstrap.hxx>
35#include <osl/process.h>
36
37// #define this to true, if remembering defaults is not supported properly
38#define RTL_BOOTSTRAP_DEFAULTS_BROKEN true
39
40constexpr OUStringLiteral BOOTSTRAP_ITEM_PRODUCT_KEY = u"ProductKey";
41constexpr OUStringLiteral BOOTSTRAP_ITEM_VERSIONFILE = u"Location";
42constexpr OUStringLiteral BOOTSTRAP_ITEM_BUILDID = u"buildid";
43
44constexpr OUStringLiteral BOOTSTRAP_ITEM_BASEINSTALLATION = u"BRAND_BASE_DIR";
45constexpr OUStringLiteral BOOTSTRAP_ITEM_USERINSTALLATION = u"UserInstallation";
46
47constexpr OUStringLiteral BOOTSTRAP_ITEM_USERDIR = u"UserDataDir";
48
49constexpr OUStringLiteral BOOTSTRAP_DEFAULT_BASEINSTALL = u"$SYSBINDIR/..";
50
51constexpr OUStringLiteral BOOTSTRAP_DIRNAME_USERDIR = u"user";
52
53typedef char const * AsciiString;
54
55namespace utl
56{
57
58// Implementation class: Bootstrap::Impl
59
60static OUString makeImplName()
61{
62 OUString uri;
63 rtl::Bootstrap::get( "BRAND_BASE_DIR", uri);
64 return uri + "/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap");
65}
66
68{
69 const OUString m_aImplName;
70public: // struct to cache the result of a path lookup
71 struct PathData
72 {
73 OUString path;
75
78 {}
79 };
80public: // data members
81 // base install data
83
84 // user install data
86
87 // INI files
90
91 // overall status
93
94public: // construction and initialization
96 {
97 initialize();
98 }
99
100 void initialize();
101
102 // access helper
103 OUString getBootstrapValue(OUString const& _sName, OUString const& _sDefault) const;
104
105 const OUString& getImplName() const { return m_aImplName; }
106
107private: // implementation
108 bool initBaseInstallationData(rtl::Bootstrap const & _rData);
109 bool initUserInstallationData(rtl::Bootstrap const & _rData);
110};
111
112namespace
113{
114 Bootstrap::Impl& theImpl()
115 {
116 static Bootstrap::Impl SINGLETON;
117 return SINGLETON;
118 }
119}
120
122{
123 return theImpl();
124}
125
127{
128 rUrl.clear();
129 OUString s("$OOO_CWD");
130 rtl::Bootstrap::expandMacros(s);
131 if (s.isEmpty())
132 {
133 if (osl_getProcessWorkingDir(&rUrl.pData) == osl_Process_E_None)
134 return true;
135 }
136 else if (s[0] == '1')
137 {
138 rUrl = s.copy(1);
139 return true;
140 }
141 else if (s[0] == '2' &&
142 (osl::FileBase::getFileURLFromSystemPath(s.copy(1), rUrl) ==
143 osl::FileBase::E_None))
144 {
145 return true;
146 }
147 return false;
148}
149
151{
152 theImpl().initialize();
153}
154
155// helper
156
158
160
161// path status utility function
162static PathStatus implCheckStatusOfURL(OUString const& _sURL, osl::DirectoryItem& aDirItem)
163{
164 using namespace osl;
165
167
168 if (!_sURL.isEmpty())
169 {
170 switch( DirectoryItem::get(_sURL, aDirItem) )
171 {
172 case DirectoryItem::E_None: // Success
173 eStatus = Bootstrap::PATH_EXISTS;
174 break;
175
176 case DirectoryItem::E_NOENT: // No such file or directory
177 eStatus = Bootstrap::PATH_VALID;
178 break;
179
180 case DirectoryItem::E_INVAL: // the format of the parameters was not valid
181 case DirectoryItem::E_NAMETOOLONG: // File name too long
182 case DirectoryItem::E_NOTDIR: // A component of the path prefix of path is not a directory
183 eStatus = Bootstrap::DATA_INVALID;
184 break;
185
186 // how to handle these ?
187 case DirectoryItem::E_LOOP: // Too many symbolic links encountered
188 case DirectoryItem::E_ACCES: // permission denied
189 // any other error - what to do ?
190 default:
191 eStatus = Bootstrap::DATA_UNKNOWN;
192 break;
193 }
194 }
195 else
196 {
197 eStatus = Bootstrap::DATA_MISSING;
198 }
199
200 return eStatus;
201}
202
203static bool implNormalizeURL(OUString & _sURL, osl::DirectoryItem& aDirItem)
204{
205 using namespace osl;
206
207 OSL_PRECOND(aDirItem.is(), "Opened DirItem required");
208
209 static const sal_uInt32 cosl_FileStatus_Mask = osl_FileStatus_Mask_FileURL;
210
211 FileStatus aFileStatus(cosl_FileStatus_Mask);
212
213 if (aDirItem.getFileStatus(aFileStatus) != DirectoryItem::E_None)
214 return false;
215
216 OUString aNormalizedURL = aFileStatus.getFileURL();
217
218 if (aNormalizedURL.isEmpty())
219 return false;
220
221 // #109863# sal/osl returns final slash for file URLs contradicting
222 // the URL/URI RFCs.
223 if ( !aNormalizedURL.endsWith(OUStringChar(cURLSeparator)) )
224 _sURL = aNormalizedURL;
225 else
226 _sURL = aNormalizedURL.copy( 0, aNormalizedURL.getLength()-1 );
227
228 return true;
229}
230
231static bool implEnsureAbsolute(OUString & _rsURL) // also strips embedded dots !!
232{
233 using osl::File;
234
235 OUString sBasePath;
236 OSL_VERIFY(Bootstrap::getProcessWorkingDir(sBasePath));
237
238 OUString sAbsolute;
239 if ( File::E_None == File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
240 {
241 _rsURL = sAbsolute;
242 return true;
243 }
244 else
245 {
246 OSL_FAIL("Could not get absolute file URL for URL");
247 return false;
248 }
249}
250
251static bool implMakeAbsoluteURL(OUString & _rsPathOrURL)
252{
253 using namespace osl;
254
255 bool bURL;
256
257 OUString sOther;
258 // check if it already was normalized
259 if ( File::E_None == File::getSystemPathFromFileURL(_rsPathOrURL, sOther) )
260 {
261 bURL = true;
262 }
263
264 else if ( File::E_None == File::getFileURLFromSystemPath(_rsPathOrURL, sOther) )
265 {
266 _rsPathOrURL = sOther;
267 bURL = true;
268 }
269 else
270 bURL = false;
271
272 return bURL && implEnsureAbsolute(_rsPathOrURL);
273}
274
275static PathStatus dbgCheckStatusOfURL(OUString const& _sURL)
276{
277 using namespace osl;
278
279 DirectoryItem aDirItem;
280
281 return implCheckStatusOfURL(_sURL,aDirItem);
282}
283
285{
286 using namespace osl;
287
289
290 if (_sURL.isEmpty())
291 eStatus = Bootstrap::DATA_MISSING;
292
293 else if ( !implMakeAbsoluteURL(_sURL) )
294 eStatus = Bootstrap::DATA_INVALID;
295
296 else
297 {
298 DirectoryItem aDirItem;
299
300 eStatus = implCheckStatusOfURL(_sURL,aDirItem);
301
302 if (eStatus == Bootstrap::PATH_EXISTS && !implNormalizeURL(_sURL,aDirItem))
303 OSL_FAIL("Unexpected failure getting actual URL for existing object");
304 }
305 return eStatus;
306}
307
308// helpers to build and check a nested URL
310 OUString& _rURL,
311 OUString const& _aBaseURL, PathStatus _aBaseStatus,
312 std::u16string_view _sRelativeURL,
313 rtl::Bootstrap const & _rData, OUString const& _sBootstrapParameter
314 )
315{
316 OUString sDerivedURL;
317 OSL_PRECOND(!_rData.getFrom(_sBootstrapParameter,sDerivedURL),"Setting for derived path is already defined");
318 OSL_PRECOND(!_sRelativeURL.empty() && _sRelativeURL[0] != cURLSeparator,"Invalid Relative URL");
319
320 PathStatus aStatus = _aBaseStatus;
321
322 // do we have a base path ?
323 if (!_aBaseURL.isEmpty())
324 {
325 OSL_PRECOND(!_aBaseURL.endsWith(OUStringChar(cURLSeparator)), "Unexpected: base URL ends in slash");
326
327 sDerivedURL = _aBaseURL + OUStringChar(cURLSeparator) + _sRelativeURL;
328
329 // a derived (nested) URL can only exist or have a lesser status, if the parent exists
330 if (aStatus == Bootstrap::PATH_EXISTS)
331 aStatus = checkStatusAndNormalizeURL(sDerivedURL);
332
333 else // the relative appendix must be valid
334 OSL_ASSERT(aStatus != Bootstrap::PATH_VALID || dbgCheckStatusOfURL(sDerivedURL) == Bootstrap::PATH_VALID);
335
336 _rData.getFrom(_sBootstrapParameter, _rURL, sDerivedURL);
337
338 OSL_ENSURE(sDerivedURL == _rURL,"Could not set derived URL via Bootstrap default parameter");
339 SAL_WARN_IF( !(RTL_BOOTSTRAP_DEFAULTS_BROKEN || (_rData.getFrom(_sBootstrapParameter,sDerivedURL) && sDerivedURL==_rURL)),
340 "unotools.config",
341 "Use of default did not affect bootstrap value");
342 }
343 else
344 {
345 // clear the result
346 _rURL = _aBaseURL;
347
348 // if we have no data it can't be a valid path
349 OSL_ASSERT( aStatus > Bootstrap::PATH_VALID );
350 }
351
352 return aStatus;
353}
354
356 OUString& _rURL,
357 Bootstrap::Impl::PathData const& _aBaseData,
358 std::u16string_view _sRelativeURL,
359 rtl::Bootstrap const & _rData, OUString const& _sBootstrapParameter
360 )
361{
362 return getDerivedPath(_rURL,_aBaseData.path,_aBaseData.status,_sRelativeURL,_rData,_sBootstrapParameter);
363}
364
365static OUString getExecutableBaseName()
366{
367 OUString sExecutable;
368
369 if (osl_Process_E_None == osl_getExecutableFile(&sExecutable.pData))
370 {
371 // split the executable name
372 sal_Int32 nSepIndex = sExecutable.lastIndexOf(cURLSeparator);
373
374 sExecutable = sExecutable.copy(nSepIndex + 1);
375
376 // ... and get the basename (strip the extension)
377 sal_Unicode const cExtensionSep = '.';
378
379 sal_Int32 const nExtIndex = sExecutable.lastIndexOf(cExtensionSep);
380 sal_Int32 const nExtLength = sExecutable.getLength() - nExtIndex - 1;
381 if (0 < nExtIndex && nExtLength < 4)
382 sExecutable = sExecutable.copy(0,nExtIndex);
383 }
384 else
385 SAL_WARN("unotools.config", "Cannot get executable name: osl_getExecutableFile failed");
386
387 return sExecutable;
388}
389
391{
392 _rResult.status = checkStatusAndNormalizeURL(_rResult.path);
393 return _rResult.status;
394}
395
396static Bootstrap::PathStatus implGetBootstrapFile(rtl::Bootstrap const & _rData, Bootstrap::Impl::PathData & _rBootstrapFile)
397{
398 _rData.getIniName(_rBootstrapFile.path);
399
400 return updateStatus(_rBootstrapFile);
401}
402
403static Bootstrap::PathStatus implGetVersionFile(rtl::Bootstrap const & _rData, Bootstrap::Impl::PathData & _rVersionFile)
404{
405 _rData.getFrom(BOOTSTRAP_ITEM_VERSIONFILE, _rVersionFile.path);
406
407 return updateStatus(_rVersionFile);
408}
409
410// Error reporting
411
412char const IS_MISSING[] = "is missing";
413char const IS_INVALID[] = "is corrupt";
414char const PERIOD[] = ". ";
415
416static void addFileError(OUStringBuffer& _rBuf, std::u16string_view _aPath, AsciiString _sWhat)
417{
418 std::u16string_view sSimpleFileName = _aPath.substr(1 +_aPath.rfind(cURLSeparator));
419
420 _rBuf.append("The configuration file");
421 _rBuf.append(OUString::Concat(" '") + sSimpleFileName + "' ");
422 _rBuf.appendAscii(_sWhat).append(PERIOD);
423}
424
425static void addMissingDirectoryError(OUStringBuffer& _rBuf, std::u16string_view _aPath)
426{
427 _rBuf.append(OUString::Concat("The configuration directory '") + _aPath + "' " +
429}
430
431static void addUnexpectedError(OUStringBuffer& _rBuf, AsciiString _sExtraInfo = nullptr)
432{
433 if (nullptr == _sExtraInfo)
434 _sExtraInfo = "An internal failure occurred";
435
436 _rBuf.appendAscii(_sExtraInfo).append(PERIOD);
437}
438
439static Bootstrap::FailureCode describeError(OUStringBuffer& _rBuf, Bootstrap::Impl const& _rData)
440{
442
443 _rBuf.append("The program cannot be started. ");
444
445 switch (_rData.aUserInstall_.status)
446 {
448 switch (_rData.aBaseInstall_.status)
449 {
453 break;
454
456 addUnexpectedError(_rBuf,"The installation path is invalid");
457 break;
458
460 addUnexpectedError(_rBuf,"The installation path is not available");
461 break;
462
463 case Bootstrap::PATH_EXISTS: // seems to be all fine (?)
464 addUnexpectedError(_rBuf,"");
465 break;
466
467 default: OSL_ASSERT(false);
468 addUnexpectedError(_rBuf);
469 break;
470 }
471 break;
472
476 break;
477
478 // else fall through
481 {
484 break;
485 }
486 [[fallthrough]];
487
489 switch (_rData.aVersionINI_.status)
490 {
492 addFileError(_rBuf, _rData.aVersionINI_.path, "does not support the current version");
494 break;
495
499 break;
500
501 default:
502 switch (_rData.aBootstrapINI_.status)
503 {
506
509 else
511 break;
512
513 case Bootstrap::DATA_INVALID: OSL_ASSERT(false); [[fallthrough]];
517 break;
518
519 default:
520 addUnexpectedError(_rBuf);
521 break;
522 }
523 break;
524 }
525 break;
526
527 default: OSL_ASSERT(false);
528 addUnexpectedError(_rBuf);
529 break;
530 }
531
532 return eErrCode;
533}
534
535
537{
538 OUString const sDefaultProductKey = getExecutableBaseName();
539
540 return data().getBootstrapValue( BOOTSTRAP_ITEM_PRODUCT_KEY, sDefaultProductKey );
541}
542
543OUString Bootstrap::getProductKey(OUString const& _sDefault)
544{
546}
547
548OUString Bootstrap::getBuildIdData(OUString const& _sDefault)
549{
550 // try to open version.ini (versionrc)
551 OUString uri;
552 rtl::Bootstrap::get( "BRAND_BASE_DIR", uri);
553 rtl::Bootstrap aData( uri + "/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") );
554 if ( aData.getHandle() == nullptr )
555 // version.ini (versionrc) doesn't exist
556 return _sDefault;
557
558 // read value
559 OUString sBuildId;
560 aData.getFrom(BOOTSTRAP_ITEM_BUILDID,sBuildId,_sDefault);
561 return sBuildId;
562}
563
565{
566 Impl::PathData const& aPathData = data().aBaseInstall_;
567
568 _rURL = aPathData.path;
569 return aPathData.status;
570}
571
573{
574 Impl::PathData const& aPathData = data().aUserInstall_;
575
576 _rURL = aPathData.path;
577 return aPathData.status;
578}
579
581{
582 OUString const csUserDirItem(BOOTSTRAP_ITEM_USERDIR);
583
584 rtl::Bootstrap aData( data().getImplName() );
585
586 if ( aData.getFrom(csUserDirItem, _rURL) )
587 {
588 return checkStatusAndNormalizeURL(_rURL);
589 }
590 else
591 {
592 return getDerivedPath(_rURL, data().aUserInstall_ ,BOOTSTRAP_DIRNAME_USERDIR, aData, csUserDirItem);
593 }
594}
595
597{
598 Impl::PathData const& aPathData = data().aBootstrapINI_;
599
600 _rURL = aPathData.path;
601 return aPathData.status;
602}
603
605{
606 Impl::PathData const& aPathData = data().aVersionINI_;
607
608 _rURL = aPathData.path;
609 return aPathData.status;
610}
611
612Bootstrap::Status Bootstrap::checkBootstrapStatus(OUString& _rDiagnosticMessage, FailureCode& _rErrCode)
613{
614 Impl const& aData = data();
615
616 Status result = aData.status_;
617
618 // maybe do further checks here
619
620 OUStringBuffer sErrorBuffer;
621 if (result != DATA_OK)
622 _rErrCode = describeError(sErrorBuffer,aData);
623
624 else
625 _rErrCode = NO_FAILURE;
626
627 _rDiagnosticMessage = sErrorBuffer.makeStringAndClear();
628
629 return result;
630}
631
632
633bool Bootstrap::Impl::initBaseInstallationData(rtl::Bootstrap const & _rData)
634{
636
637 bool bResult = (PATH_EXISTS == updateStatus(aBaseInstall_));
638
640
641 return bResult;
642}
643
644bool Bootstrap::Impl::initUserInstallationData(rtl::Bootstrap const & _rData)
645{
646 if (_rData.getFrom(BOOTSTRAP_ITEM_USERINSTALLATION, aUserInstall_.path))
647 {
648 updateStatus(aUserInstall_);
649 }
650 else
651 {
652 // should we do just this
653 aUserInstall_.status = DATA_MISSING;
654
655 // ... or this - look for a single-user user directory ?
656 OUString const csUserDirItem(BOOTSTRAP_ITEM_USERDIR);
657 OUString sDummy;
658 // look for $BASEINSTALLATION/user only if default UserDir setting is used
659 if (! _rData.getFrom(csUserDirItem, sDummy))
660 {
661 if ( PATH_EXISTS == getDerivedPath(sDummy, aBaseInstall_, BOOTSTRAP_DIRNAME_USERDIR, _rData, csUserDirItem) )
662 aUserInstall_ = aBaseInstall_;
663 }
664 }
665
666 bool bResult = (PATH_EXISTS == aUserInstall_.status);
667
668 implGetVersionFile(_rData, aVersionINI_);
669
670 return bResult;
671}
672
674{
675 rtl::Bootstrap aData( m_aImplName );
676
677 if (!initBaseInstallationData(aData))
678 {
679 status_ = INVALID_BASE_INSTALL;
680 }
681 else if (!initUserInstallationData(aData))
682 {
683 status_ = INVALID_USER_INSTALL;
684
685 if (aUserInstall_.status >= DATA_MISSING)
686 {
687 switch (aVersionINI_.status)
688 {
689 case PATH_EXISTS:
690 case PATH_VALID:
691 status_ = MISSING_USER_INSTALL;
692 break;
693
694 case DATA_INVALID:
695 case DATA_MISSING:
696 status_ = INVALID_BASE_INSTALL;
697 break;
698 default:
699 break;
700 }
701 }
702 }
703 else
704 {
705 status_ = DATA_OK;
706 }
707}
708
709OUString Bootstrap::Impl::getBootstrapValue(OUString const& _sName, OUString const& _sDefault) const
710{
711 rtl::Bootstrap aData( m_aImplName );
712
713 OUString sResult;
714 aData.getFrom(_sName,sResult,_sDefault);
715 return sResult;
716}
717
718} // namespace utl
719
720/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral BOOTSTRAP_DIRNAME_USERDIR
Definition: bootstrap.cxx:51
constexpr OUStringLiteral BOOTSTRAP_ITEM_USERDIR
Definition: bootstrap.cxx:47
#define RTL_BOOTSTRAP_DEFAULTS_BROKEN
Definition: bootstrap.cxx:38
constexpr OUStringLiteral BOOTSTRAP_DEFAULT_BASEINSTALL
Definition: bootstrap.cxx:49
constexpr OUStringLiteral BOOTSTRAP_ITEM_BASEINSTALLATION
Definition: bootstrap.cxx:44
constexpr OUStringLiteral BOOTSTRAP_ITEM_BUILDID
Definition: bootstrap.cxx:42
constexpr OUStringLiteral BOOTSTRAP_ITEM_PRODUCT_KEY
Definition: bootstrap.cxx:40
char const * AsciiString
Definition: bootstrap.cxx:53
constexpr OUStringLiteral BOOTSTRAP_ITEM_VERSIONFILE
Definition: bootstrap.cxx:41
constexpr OUStringLiteral BOOTSTRAP_ITEM_USERINSTALLATION
Definition: bootstrap.cxx:45
bool initBaseInstallationData(rtl::Bootstrap const &_rData)
Definition: bootstrap.cxx:633
const OUString & getImplName() const
Definition: bootstrap.cxx:105
PathData aBootstrapINI_
Definition: bootstrap.cxx:88
bool initUserInstallationData(rtl::Bootstrap const &_rData)
Definition: bootstrap.cxx:644
OUString getBootstrapValue(OUString const &_sName, OUString const &_sDefault) const
Definition: bootstrap.cxx:709
PathData aBaseInstall_
Definition: bootstrap.cxx:82
PathData aUserInstall_
Definition: bootstrap.cxx:85
const OUString m_aImplName
Definition: bootstrap.cxx:69
static PathStatus locateVersionFile(OUString &_rURL)
get a file URL to the version locator INI file used [e.g. ${SYSUSERCONFIG}/sversion....
Definition: bootstrap.cxx:604
static PathStatus locateUserInstallation(OUString &_rURL)
get a file URL to the user installation [${userurl}]
Definition: bootstrap.cxx:572
static Status checkBootstrapStatus(OUString &_rDiagnosticMessage, FailureCode &_rErrCode)
Evaluates the status of the installation and returns a diagnostic message and error code correspondin...
Definition: bootstrap.cxx:612
static PathStatus locateUserData(OUString &_rURL)
get a file URL to the user data directory [default is ${userurl}/user]
Definition: bootstrap.cxx:580
static PathStatus locateBaseInstallation(OUString &_rURL)
get a file URL to the common base installation [${insturl}]
Definition: bootstrap.cxx:564
static OUString getProductKey()
retrieve the product key; defaults to executable name (without extension)
Definition: bootstrap.cxx:536
FailureCode
error code for detailed diagnostics of bootstrap failures
Definition: bootstrap.hxx:89
@ MISSING_BOOTSTRAP_FILE
the shared installation directory could not be located
Definition: bootstrap.hxx:92
@ MISSING_VERSION_FILE_ENTRY
the version locator INI file could not be found or read
Definition: bootstrap.hxx:96
@ INVALID_BOOTSTRAP_FILE_ENTRY
the bootstrap INI is missing a required entry
Definition: bootstrap.hxx:94
@ MISSING_USER_DIRECTORY
the version locator INI entry is not a valid directory URL
Definition: bootstrap.hxx:98
@ INVALID_VERSION_FILE_ENTRY
the version locator INI has no entry for this version
Definition: bootstrap.hxx:97
@ MISSING_BOOTSTRAP_FILE_ENTRY
the bootstrap INI file could not be found or read
Definition: bootstrap.hxx:93
@ MISSING_VERSION_FILE
the bootstrap INI contains invalid data
Definition: bootstrap.hxx:95
@ INVALID_BOOTSTRAP_DATA
the user installation directory does not exist
Definition: bootstrap.hxx:99
@ MISSING_INSTALL_DIRECTORY
bootstrap was successful
Definition: bootstrap.hxx:91
static OUString getBuildIdData(OUString const &_sDefault)
retrieve the BUILDID information item; uses the given default, if not found
Definition: bootstrap.cxx:548
static const Impl & data()
Definition: bootstrap.cxx:121
static void reloadData()
reload cached data
Definition: bootstrap.cxx:150
Status
high-level status of bootstrap success
Definition: bootstrap.hxx:80
@ INVALID_BASE_INSTALL
can locate ${userurl}, but user-dir is missing
Definition: bootstrap.hxx:84
@ INVALID_USER_INSTALL
${userurl} does not exist; or version-file cannot be found or is invalid
Definition: bootstrap.hxx:83
@ MISSING_USER_INSTALL
user-dir and share-dir do exist, product key found or can be defaulted to exe-name
Definition: bootstrap.hxx:82
static PathStatus locateBootstrapFile(OUString &_rURL)
get a file URL to the bootstrap INI file used [e.g. ${insturl}/program/bootraprc]
Definition: bootstrap.cxx:596
static bool getProcessWorkingDir(OUString &rUrl)
get the working directory of the process
Definition: bootstrap.cxx:126
#define SAL_CONFIGFILE(name)
float u
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
OUString get(TranslateId sContextAndId, const std::locale &loc)
Definition: resmgr.cxx:211
FileStatus
static PathStatus dbgCheckStatusOfURL(OUString const &_sURL)
Definition: bootstrap.cxx:275
static Bootstrap::FailureCode describeError(OUStringBuffer &_rBuf, Bootstrap::Impl const &_rData)
Definition: bootstrap.cxx:439
static PathStatus getDerivedPath(OUString &_rURL, OUString const &_aBaseURL, PathStatus _aBaseStatus, std::u16string_view _sRelativeURL, rtl::Bootstrap const &_rData, OUString const &_sBootstrapParameter)
Definition: bootstrap.cxx:309
static void addMissingDirectoryError(OUStringBuffer &_rBuf, std::u16string_view _aPath)
Definition: bootstrap.cxx:425
static OUString makeImplName()
Definition: bootstrap.cxx:60
static void addFileError(OUStringBuffer &_rBuf, std::u16string_view _aPath, AsciiString _sWhat)
Definition: bootstrap.cxx:416
static bool implNormalizeURL(OUString &_sURL, osl::DirectoryItem &aDirItem)
Definition: bootstrap.cxx:203
static bool implEnsureAbsolute(OUString &_rsURL)
Definition: bootstrap.cxx:231
char const IS_INVALID[]
Definition: bootstrap.cxx:413
Bootstrap::PathStatus PathStatus
Definition: bootstrap.cxx:157
static Bootstrap::PathStatus implGetVersionFile(rtl::Bootstrap const &_rData, Bootstrap::Impl::PathData &_rVersionFile)
Definition: bootstrap.cxx:403
static bool implMakeAbsoluteURL(OUString &_rsPathOrURL)
Definition: bootstrap.cxx:251
static Bootstrap::PathStatus implGetBootstrapFile(rtl::Bootstrap const &_rData, Bootstrap::Impl::PathData &_rBootstrapFile)
Definition: bootstrap.cxx:396
char const IS_MISSING[]
Definition: bootstrap.cxx:412
static PathStatus checkStatusAndNormalizeURL(OUString &_sURL)
Definition: bootstrap.cxx:284
static void addUnexpectedError(OUStringBuffer &_rBuf, AsciiString _sExtraInfo=nullptr)
Definition: bootstrap.cxx:431
static Bootstrap::PathStatus updateStatus(Bootstrap::Impl::PathData &_rResult)
Definition: bootstrap.cxx:390
static PathStatus implCheckStatusOfURL(OUString const &_sURL, osl::DirectoryItem &aDirItem)
Definition: bootstrap.cxx:162
static OUString getExecutableBaseName()
Definition: bootstrap.cxx:365
char const PERIOD[]
Definition: bootstrap.cxx:414
sal_Unicode const cURLSeparator
Definition: bootstrap.cxx:159
sal_uInt16 sal_Unicode
Any result