harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r708472 - /harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/windows/javaw.c
Date Tue, 28 Oct 2008 08:01:20 GMT
Author: hindessm
Date: Tue Oct 28 01:01:19 2008
New Revision: 708472

URL: http://svn.apache.org/viewvc?rev=708472&view=rev
Log:
Attempt to fix windows break in r708057.

Modified:
    harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/windows/javaw.c

Modified: harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/windows/javaw.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/windows/javaw.c?rev=708472&r1=708471&r2=708472&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/windows/javaw.c (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/windows/javaw.c Tue
Oct 28 01:01:19 2008
@@ -17,9 +17,11 @@
 
 #include <windows.h>
 #include <stdio.h>
+#include <sys/stat.h>
 
 #define JDK_WEXE_POSTFIX        "\\jre\\bin\\javaw.exe\" "
 #define JRE_WEXE_POSTFIX        "\\bin\\javaw.exe\" "
+#define JRE_TEST_FILE       "\\bin\\harmony.properties"
 
 char *getRoot();
 int isJRERoot(const char*);
@@ -65,3 +67,38 @@
 
     return (int)res;
 }
+
+/*****************************************************************
+ * isJRERoot(const char* root)
+ * 
+ *  returns 1 if root is the jre root
+ */
+int isJRERoot(const char* root) {
+
+    char *temp = NULL;
+#if defined(WIN32)
+    DWORD result;
+#else
+    struct stat statbuf;
+    int rc;
+#endif
+
+    temp = (char *) malloc(strlen(root) + strlen(JRE_TEST_FILE) + 1);
+                
+    if (temp == NULL) { 
+        return -1;
+    }
+    
+    strcpy(temp, root);
+    strcat(temp, JRE_TEST_FILE);
+    
+#if defined(WIN32)
+    result = GetFileAttributes((LPCTSTR) temp);
+    free(temp);
+    return result == 0xFFFFFFFF ? 0 : 1;
+#else
+    rc = lstat(temp, &statbuf);
+    free(temp);
+    return rc == -1 ? 0 : 1;
+#endif
+}



Mime
View raw message