author | herrick |
Fri, 08 Nov 2019 14:53:03 -0500 | |
branch | JDK-8200758-branch |
changeset 58994 | b09ba68c6a19 |
parent 57413 | src/jdk.jpackage/windows/native/libjpackage/ErrorHandling.cpp@45c74e654794 |
permissions | -rw-r--r-- |
57413
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
1 |
/* |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
4 |
* |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
10 |
* |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
15 |
* accompanied this code). |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
16 |
* |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
20 |
* |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
23 |
* questions. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
24 |
*/ |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
25 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
26 |
#include <algorithm> |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
27 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
28 |
#include "ErrorHandling.h" |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
29 |
#include "Log.h" |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
30 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
31 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
32 |
namespace { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
33 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
34 |
tstring getFilename(const SourceCodePos& pos) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
35 |
const std::string buf(pos.file); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
36 |
const std::string::size_type idx = buf.find_last_of("\\/"); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
37 |
if (idx == std::string::npos) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
38 |
return tstrings::fromUtf8(buf); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
39 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
40 |
return tstrings::fromUtf8(buf.substr(idx + 1)); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
41 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
42 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
43 |
void reportError(const SourceCodePos& pos, const tstring& msg) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
44 |
Logger::defaultLogger().log(Logger::LOG_ERROR, getFilename(pos).c_str(), |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
45 |
pos.lno, tstrings::fromUtf8(pos.func).c_str(), msg); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
46 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
47 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
48 |
} // namespace |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
49 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
50 |
void reportError(const SourceCodePos& pos, const std::exception& e) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
51 |
reportError(pos, (tstrings::any() << "Exception with message \'" |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
52 |
<< e.what() << "\' caught").tstr()); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
53 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
54 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
55 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
56 |
void reportUnknownError(const SourceCodePos& pos) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
57 |
reportError(pos, _T("Unknown exception caught")); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
58 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
59 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
60 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
61 |
std::string makeMessage(const std::exception& e, const SourceCodePos& pos) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
62 |
std::ostringstream printer; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
63 |
printer << getFilename(pos) << "(" << pos.lno << ") at " |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
64 |
<< pos.func << "(): " |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
65 |
<< e.what(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
66 |
return printer.str(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
67 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
68 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
69 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
70 |
namespace { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
71 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
72 |
bool isNotSpace(int chr) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
73 |
return isspace(chr) == 0; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
74 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
75 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
76 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
77 |
enum TrimMode { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
78 |
TrimLeading = 0x10, |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
79 |
TrimTrailing = 0x20, |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
80 |
TrimBoth = TrimLeading | TrimTrailing |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
81 |
}; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
82 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
83 |
// Returns position of the last printed character in the given string. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
84 |
// Returns std::string::npos if nothing was printed. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
85 |
size_t printWithoutWhitespaces(std::ostream& out, const std::string& str, |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
86 |
TrimMode mode) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
87 |
std::string::const_reverse_iterator it = str.rbegin(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
88 |
std::string::const_reverse_iterator end = str.rend(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
89 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
90 |
if (mode & TrimLeading) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
91 |
// skip leading whitespace |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
92 |
std::string::const_iterator entry = std::find_if(str.begin(), |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
93 |
str.end(), isNotSpace); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
94 |
end = std::string::const_reverse_iterator(entry); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
95 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
96 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
97 |
if (mode & TrimTrailing) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
98 |
// skip trailing whitespace |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
99 |
it = std::find_if(it, end, isNotSpace); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
100 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
101 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
102 |
if (it == end) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
103 |
return std::string::npos; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
104 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
105 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
106 |
const size_t pos = str.rend() - end; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
107 |
const size_t len = end - it; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
108 |
out.write(str.c_str() + pos, len); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
109 |
return pos + len - 1; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
110 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
111 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
112 |
} // namespace |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
113 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
114 |
std::string joinErrorMessages(const std::string& a, const std::string& b) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
115 |
const std::string endPhraseChars(";.,:!?"); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
116 |
const std::string space(" "); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
117 |
const std::string dotAndSpace(". "); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
118 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
119 |
std::ostringstream printer; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
120 |
printer.exceptions(std::ios::failbit | std::ios::badbit); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
121 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
122 |
size_t idx = printWithoutWhitespaces(printer, a, TrimTrailing); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
123 |
size_t extra = 0; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
124 |
if (idx < a.size() && endPhraseChars.find(a[idx]) == std::string::npos) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
125 |
printer << dotAndSpace; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
126 |
extra = dotAndSpace.size(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
127 |
} else if (idx != std::string::npos) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
128 |
printer << space; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
129 |
extra = space.size(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
130 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
131 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
132 |
idx = printWithoutWhitespaces(printer, b, TrimBoth); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
133 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
134 |
const std::string str = printer.str(); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
135 |
|
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
136 |
if (std::string::npos == idx && extra) { |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
137 |
// Nothing printed from the 'b' message. Backout delimiter string. |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
138 |
return str.substr(0, str.size() - extra); |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
139 |
} |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
140 |
return str; |
45c74e654794
8221333: Replace Inno Setup with custom MSI wrapper for .exe bundler (missed files)
herrick
parents:
diff
changeset
|
141 |
} |