No need to perform this check twice... it has been done on Scilab startup and it...
Sylvestre Ledru [Mon, 18 Aug 2008 14:29:34 +0000 (14:29 +0000)]
scilab/modules/jvm/src/c/loadOnUseClassPath.c

index 317e490..c2892e0 100644 (file)
@@ -41,13 +41,10 @@ BOOL loadOnUseClassPath(char *tag)
        // Load the XML
        if ( FileExist(classpathfile) )
        {
-               char *encoding = GetXmlFileEncoding(classpathfile);
-
                /* Don't care about line return / empty line */
                xmlKeepBlanksDefault(0);
                /* check if the XML file has been encoded with utf8 (unicode) or not */
-               if ( stricmp("utf-8", encoding)==0 )
-               {
+
                        xmlDocPtr doc;
                        xmlXPathContextPtr xpathCtxt = NULL;
                        xmlXPathObjectPtr xpathObj = NULL;
@@ -62,7 +59,6 @@ BOOL loadOnUseClassPath(char *tag)
                        if (doc == NULL) 
                        {
                                fprintf(stderr,_("Error: could not parse file %s\n"), classpathfile);
-                               if (encoding) {FREE(encoding);encoding=NULL;}
                                return bOK;
                        }
 
@@ -86,24 +82,24 @@ BOOL loadOnUseClassPath(char *tag)
 
                                                        /* we found the tag value  & load the jar */
                                                        /* replaces $SCILAB by current path of SCI */
-                                                       #define KEYWORDSCILAB "$SCILAB" \r
-                                                       char *sciPath = getSCIpath();\r
-                                                       char *FullClasspath = NULL;\r
-                                                       char *classpath = (char*)attrib->children->content;\r
-                                               \r
-                                                       if (strncmp(classpath,KEYWORDSCILAB,strlen(KEYWORDSCILAB))==0)\r
-                                                       {\r
-                                                               FullClasspath = (char*)MALLOC(sizeof(char)*(strlen(sciPath)+strlen(classpath)+1));\r
-                                                               if (FullClasspath)\r
-                                                               {\r
-                                                                       strcpy(FullClasspath,sciPath);\r
-                                                                       strcat(FullClasspath,&classpath[strlen(KEYWORDSCILAB)]);\r
-                                                               }\r
-                                                       }\r
-                                                       else\r
-                                                       {\r
-                                                               FullClasspath = strdup(classpath);\r
-                                                       }\r
+                                                       #define KEYWORDSCILAB "$SCILAB" 
+                                                       char *sciPath = getSCIpath();
+                                                       char *FullClasspath = NULL;
+                                                       char *classpath = (char*)attrib->children->content;
+                                               
+                                                       if (strncmp(classpath,KEYWORDSCILAB,strlen(KEYWORDSCILAB))==0)
+                                                       {
+                                                               FullClasspath = (char*)MALLOC(sizeof(char)*(strlen(sciPath)+strlen(classpath)+1));
+                                                               if (FullClasspath)
+                                                               {
+                                                                       strcpy(FullClasspath,sciPath);
+                                                                       strcat(FullClasspath,&classpath[strlen(KEYWORDSCILAB)]);
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               FullClasspath = strdup(classpath);
+                                                       }
 
                                                        addToClasspath(FullClasspath,STARTUP);
                                                        FREE(FullClasspath);
@@ -124,12 +120,6 @@ BOOL loadOnUseClassPath(char *tag)
                        * Cleanup function for the XML library.
                        */
                        xmlCleanupParser();
-               }
-               else
-               {
-                       fprintf(stderr,_("Error : Not a valid classpath file %s (encoding not 'utf-8') Encoding '%s' found\n"), classpathfile, encoding);
-               }
-               if (encoding) {FREE(encoding);encoding=NULL;}
 
        } 
        else