aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/native
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2017-02-15 16:08:45 +0000
committerGravatar Yue Gan <yueg@google.com>2017-02-15 19:19:31 +0000
commit81f92feeb8ae8e22b62edf90f6b7d44baaec2fbd (patch)
tree31d0d3d3ce5aa6ceb919d212538b3b5a658f62fc /src/main/native
parent3635539af5cce8c8d3795f745c678c890b45e9b5 (diff)
Windows: use JNI CreateJunction in Java code
Use the new CreateJunction in the Windows JNI code every time we need to create junctions. This means updating WindowsFileOperations and related tests. Add test for WindowsFileSystem.createSymbolicLink. See https://github.com/bazelbuild/bazel/issues/2238 -- Change-Id: I5827e2e70e8e147f5f102fabf95fa9a148b3bcdc Reviewed-on: https://cr.bazel.build/8896 PiperOrigin-RevId: 147598107 MOS_MIGRATED_REVID=147598107
Diffstat (limited to 'src/main/native')
-rw-r--r--src/main/native/windows_processes.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/native/windows_processes.cc b/src/main/native/windows_processes.cc
index f016550d48..a014a8cdaa 100644
--- a/src/main/native/windows_processes.cc
+++ b/src/main/native/windows_processes.cc
@@ -625,3 +625,16 @@ Java_com_google_devtools_build_lib_windows_WindowsFileOperations_nativeGetLongPa
wcslen(result.get())));
return JNI_TRUE;
}
+
+extern "C" JNIEXPORT jboolean JNICALL
+Java_com_google_devtools_build_lib_windows_WindowsFileOperations_nativeCreateJunction(
+ JNIEnv* env, jclass clazz, jstring name, jstring target,
+ jobjectArray error_msg_holder) {
+ std::string error = windows_util::CreateJunction(GetJavaWstring(env, name),
+ GetJavaWstring(env, target));
+ if (!error.empty()) {
+ MaybeReportLastError(error, env, error_msg_holder);
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}