"git@sissource.ethz.ch:sispub/openbis.git" did not exist on "af5446ddb239439cd332f29164ed628115d99f95"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <jni.h>
JNIEXPORT jint JNICALL Java_ch_systemsx_cisd_common_utilities_FileLinkUtilities_hardlink
(JNIEnv *env, jclass clss, jstring filename, jstring linktarget)
{
const char* pfilename;
const char* plinktarget;
jboolean isCopy;
int retval;
pfilename = (char *)(*env)->GetStringUTFChars(env, filename, &isCopy);
plinktarget = (char *)(*env)->GetStringUTFChars(env, linktarget, &isCopy);
retval = link(pfilename, plinktarget);
if (retval < 0)
{
retval = errno;
}
(*env)->ReleaseStringUTFChars(env, filename, pfilename);
(*env)->ReleaseStringUTFChars(env, linktarget, plinktarget);
return retval;
}
JNIEXPORT jint JNICALL Java_ch_systemsx_cisd_common_utilities_FileLinkUtilities_symlink
(JNIEnv *env, jclass clss, jstring filename, jstring linktarget)
{
const char* pfilename;
const char* plinktarget;
jboolean isCopy;
int retval;
pfilename = (char *)(*env)->GetStringUTFChars(env, filename, &isCopy);
plinktarget = (char *)(*env)->GetStringUTFChars(env, linktarget, &isCopy);
retval = symlink(pfilename, plinktarget);
if (retval < 0) {
retval = errno;
}
(*env)->ReleaseStringUTFChars(env, filename, pfilename);
(*env)->ReleaseStringUTFChars(env, linktarget, plinktarget);
return retval;
}
JNIEXPORT jstring JNICALL Java_ch_systemsx_cisd_common_utilities_FileLinkUtilities_strerror(JNIEnv *env, jclass clss, jint errnum)
{
return (*env)->NewStringUTF(env, strerror(errnum));
}