commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r828627 - /commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c
Date Thu, 22 Oct 2009 09:51:11 GMT
Author: mturk
Date: Thu Oct 22 09:51:10 2009
New Revision: 828627

URL: http://svn.apache.org/viewvc?rev=828627&view=rev
Log:
Implement win32 chdir/getcwd

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c?rev=828627&r1=828626&r2=828627&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c Thu Oct 22 09:51:10 2009
@@ -265,3 +265,47 @@
     else
         return NULL;
 }
+
+ACR_IO_EXPORT_DECLARE(jstring, Directory, getcwd0)(ACR_JNISTDARGS)
+{
+    DWORD   l;
+    wchar_t path[ACR_HBUFF_SIZ];
+    wchar_t rcwd[ACR_HBUFF_SIZ];
+
+    UNREFERENCED_O;
+
+    l = GetCurrentDirectoryW(ACR_HBUFF_LEN, path);
+    if (l == 0) {
+        ACR_THROW_IO_ERRNO();
+        return NULL;
+    }
+    if (l >= ACR_HBUFF_SIZ) {
+        ACR_THROW_IO_IF_ERR(ACR_EOVERFLOW);
+        return NULL;
+    }
+    l = GetFullPathNameW(path, ACR_HBUFF_LEN, rcwd, NULL);
+    if (l == 0) {
+        ACR_THROW_IO_ERRNO();
+        return NULL;
+    }
+    if (l >= ACR_HBUFF_SIZ) {
+        ACR_THROW_IO_IF_ERR(ACR_EOVERFLOW);
+        return NULL;
+    }
+    return acr_NewJavaNativePathW(_E, rcwd);
+}
+
+ACR_IO_EXPORT_DECLARE(jint, Directory, chdir0)(ACR_JNISTDARGS, jstring path)
+{
+    int rv = ACR_EINVAL;
+
+    UNREFERENCED_O;
+    WITH_ZWPATH(path) {
+        if (!SetCurrentDirectoryW(J2W(path)))
+            rv = ACR_GET_OS_ERROR();
+        else
+            rv = 0;
+    } END_WITH_WPATH(path);
+
+    return rv;
+}



Mime
View raw message