]> Creatis software - creaContours.git/blobdiff - lib/kernel_ManagerContour_NDimensions/ParserOsirix/OsirixParser.cxx
Loading osirix files, problem when installed version
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / ParserOsirix / OsirixParser.cxx
index 4c36214c9b7774b60deb4a6ebf8ba586ecd72453..030590434a895fa0a970f9d6df2c041731881bb5 100644 (file)
@@ -65,6 +65,7 @@ OsirixParser::OsirixParser(std::string xsdfile, double* spacing, int* extent)
        /*STATICCONTOURS*/
        CREACONTOUR_NUMBEROFCONTOURSSTATIC = "NumberOfContoursStatic";
 
+        TEMPIMPORTOSIRIXFILE = "";
 
 #ifdef WIN32
 
@@ -77,7 +78,15 @@ OsirixParser::OsirixParser(std::string xsdfile, double* spacing, int* extent)
        TEMPIMPORTOSIRIXFILE.append("\\data\\TEMPIMPORTOSIRIXFILE.roi");
        
 #else
-       TEMPIMPORTOSIRIXFILE = "./data/TEMPIMPORTOSIRIXFILE";
+        char * pPath;
+        pPath = getenv ("HOME");
+
+        if(pPath){
+            TEMPIMPORTOSIRIXFILE.append(pPath);
+        }else{
+            TEMPIMPORTOSIRIXFILE.append(".");
+        }
+        TEMPIMPORTOSIRIXFILE.append("/.creaContourDataTemp/TEMPIMPORTOSIRIXFILE.roi");
 #endif
        
 }
@@ -470,12 +479,20 @@ void      OsirixParserErrorHandler::error (const SAXParseException &exc){
        char c[1000];
        errormsg = "Column ";
 //     errormsg +=     itoa(exc.getColumnNumber(),c,10);
+#ifdef WIN32
        sprintf_s(c,"%d",(int)(exc.getColumnNumber()));
+#else
+       sprintf(c,"%d",(int)(exc.getColumnNumber()));
+#endif
        errormsg +=     std::string(c);
 
        errormsg += " Line ";
 //     errormsg +=     itoa(exc.getLineNumber(),c,10);
+#ifdef WIN32
        sprintf_s(c,"%d",(int)(exc.getLineNumber()));
+#else
+       sprintf(c,"%d",(int)(exc.getLineNumber()));
+#endif
        errormsg +=     std::string(c);
 
        errormsg += " ";
@@ -487,12 +504,20 @@ void      OsirixParserErrorHandler::fatalError (const SAXParseException &exc){
        char c[1000];
        errormsg = "Column ";
 //     errormsg +=     itoa(exc.getColumnNumber(),c,10);
+#ifdef WIN32
        sprintf_s(c,"%d",(int)(exc.getColumnNumber()));
+#else
+       sprintf(c,"%d",(int)(exc.getColumnNumber()));
+#endif
        errormsg +=     std::string(c);
 
        errormsg += " Line ";
 //     errormsg +=     itoa(exc.getLineNumber(),c,10);
+#ifdef WIN32
        sprintf_s(c,"%d",(int)(exc.getLineNumber()));
+#else
+       sprintf(c,"%d",(int)(exc.getLineNumber()));
+#endif
        errormsg +=     std::string(c);
 
        errormsg += " ";