Skip to content

Commit 5b35276

Browse files
BoleynSucopybara-github
authored andcommitted
java_launcher: Fix non-portable ofstream usage
wofstream cannot be constructed from wstring according to the standard https://en.cppreference.com/w/cpp/io/basic_ofstream/basic_ofstream. Closes #24703. PiperOrigin-RevId: 707172911 Change-Id: I973f9560c5b20748e4635cd757f53fff9c8ef0c5
1 parent e8925c3 commit 5b35276

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tools/launcher/java_launcher.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,11 @@ wstring JavaBinaryLauncher::CreateClasspathJar(const wstring& classpath) {
249249
wstring jar_manifest_file_path =
250250
binary_base_path + rand_id + L".jar_manifest";
251251
blaze_util::AddUncPrefixMaybe(&jar_manifest_file_path);
252+
#if (__cplusplus >= 201703L)
253+
wofstream jar_manifest_file(std::filesystem::path(jar_manifest_file_path));
254+
#else
252255
wofstream jar_manifest_file(jar_manifest_file_path);
256+
#endif
253257
jar_manifest_file << L"Manifest-Version: 1.0\n";
254258
// No line in the MANIFEST.MF file may be longer than 72 bytes.
255259
// A space prefix indicates the line is still the content of the last

0 commit comments

Comments
 (0)