]> git.donarmstrong.com Git - mothur.git/blobdiff - mothurout.cpp
added cluster.fragments command as well as the nseqs parameter to the venn command
[mothur.git] / mothurout.cpp
index aab9945230f680e4ce106e4266ff66ba5ee7c34e..67c62c1bed469a387462f5decac8252971dda43e 100644 (file)
@@ -502,19 +502,29 @@ string MothurOut::getFullPathName(string fileName){
                #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)   
                        
                        if (path.find("~") != -1) { //go to home directory
-                               string homeDir = getenv ("HOME");
+                               string homeDir;
+                       
+                               char *homepath = NULL;
+                               homepath = getenv ("HOME");
+                               if ( homepath != NULL) { homeDir = homepath; }
+                               else { homeDir = "";  }
+
                                newFileName = homeDir + fileName.substr(fileName.find("~")+1);
                                return newFileName;
                        }else { //find path
                                if (path.rfind("./") == -1) { return fileName; } //already complete name
                                else { newFileName = fileName.substr(fileName.rfind("./")+2); } //save the complete part of the name
                                
-                               char* cwdpath = new char[1024];
+                               //char* cwdpath = new char[1024];
+                               //size_t size;
+                               //cwdpath=getcwd(cwdpath,size);
+                               //cwd = cwdpath;
+                               
+                               char *cwdpath = NULL;
+                               cwdpath = getcwd(NULL, 0); // or _getcwd
+                               if ( cwdpath != NULL) { cwd = cwdpath; }
+                               else { cwd = "";  }
 
-                               size_t size;
-                               cwdpath=getcwd(cwdpath,size);
-                       
-                               cwd = cwdpath;
                                
                                //rip off first '/'
                                string simpleCWD;