diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-24 18:25:09 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-24 18:25:09 +0100 |
commit | 0574eab8bc7d8e72db862ec36815835938a5fdf1 (patch) | |
tree | 6588315e33f95de9fbb150f862064471a975050e /java | |
parent | 8228eec99045ae720d8ef35851aa8c278f6b4e5c (diff) | |
download | libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.gz libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.xz libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.zip |
Generated code for 'mkdtemp' command.
Diffstat (limited to 'java')
-rw-r--r-- | java/com/redhat/et/libguestfs/GuestFS.java | 31 | ||||
-rw-r--r-- | java/com_redhat_et_libguestfs_GuestFS.c | 21 |
2 files changed, 52 insertions, 0 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java index 36689700..dff2373b 100644 --- a/java/com/redhat/et/libguestfs/GuestFS.java +++ b/java/com/redhat/et/libguestfs/GuestFS.java @@ -3534,4 +3534,35 @@ public HashMap<String,String> test0rhashtableerr () private native void _scrub_freespace (long g, String dir) throws LibGuestFSException; + /** + * create a temporary directory + * <p> + * This command creates a temporary directory. The + * "template" parameter should be a full pathname for the + * temporary directory with the six characters being + * "XXXXXX". + * <p> + * For example: "/tmp/tmpXXXXXX" or "/Temp/tmpXXXXXX", the + * second one being suitable for Windows. + * <p> + * The name of the temporary directory that was created is + * returned. + * <p> + * The caller is responsible for deleting the temporary + * directory and its contents after use. + * <p> + * See also: mkdtemp(3) + * <p> + * @throws LibGuestFSException + */ + public String mkdtemp (String template) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mkdtemp: handle is closed"); + return _mkdtemp (g, template); + } + private native String _mkdtemp (long g, String template) + throws LibGuestFSException; + } diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c index 37cd4c9a..3048cef6 100644 --- a/java/com_redhat_et_libguestfs_GuestFS.c +++ b/java/com_redhat_et_libguestfs_GuestFS.c @@ -4124,3 +4124,24 @@ Java_com_redhat_et_libguestfs_GuestFS__1scrub_1freespace } } +JNIEXPORT jstring JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1mkdtemp + (JNIEnv *env, jobject obj, jlong jg, jstring jtemplate) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + jstring jr; + char *r; + const char *template; + + template = (*env)->GetStringUTFChars (env, jtemplate, NULL); + r = guestfs_mkdtemp (g, template); + (*env)->ReleaseStringUTFChars (env, jtemplate, template); + if (r == NULL) { + throw_exception (env, guestfs_last_error (g)); + return NULL; + } + jr = (*env)->NewStringUTF (env, r); + free (r); + return jr; +} + |