Permalink
Browse files

Fixes windows bug with make.file

  • Loading branch information...
1 parent 167b18f commit 088c67c6a1334d716a143d57bbd9e327efa146fa @mothur-westcott mothur-westcott committed Sep 8, 2016
Showing with 31 additions and 3 deletions.
  1. +29 −3 source/commands/makefilecommand.cpp
  2. +2 −0 source/commands/makefilecommand.h
@@ -145,9 +145,7 @@ int MakeFileCommand::execute(){
//find all .fastq files
string tempFile = inputDir + "fileList.temp";
- string findCommand = "find \"" + inputDir.substr(0, inputDir.length()-1) + "\" -maxdepth 1 -name \"*." + typeFile + "\" > \"" + tempFile + "\"";
- if (m->debug) { m->mothurOut(findCommand + "\n"); }
- system(findCommand.c_str());
+ fillAccnosFile(tempFile);
//read in list of files
vector<string> fastqFiles;
@@ -251,4 +249,32 @@ int MakeFileCommand::execute(){
}
//**********************************************************************************************************************
+int MakeFileCommand::fillAccnosFile(string tempFile){
+ try {
+
+ string findCommand = "";
+ tempFile = "\"" + tempFile + "\"";
+
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+
+ findCommand = "find \"" + inputDir.substr(0, inputDir.length()-1) + "\" -maxdepth 1 -name \"*." + typeFile + " > " + tempFile;
+ if (m->debug) { m->mothurOut(findCommand + "\n"); }
+ system(findCommand.c_str());
+#else
+ //use ls command
+
+ findCommand = "ls *." + typeFile + " > " + tempFile;
+ if (m->debug) { m->mothurOut(findCommand + "\n"); }
+ system(findCommand.c_str());
+#endif
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "MakeFileCommand", "fillAccnosFile");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+
@@ -36,6 +36,8 @@ class MakeFileCommand : public Command {
vector<string> outputNames;
int numCols;
bool abort;
+
+ int fillAccnosFile(string);
};

0 comments on commit 088c67c

Please sign in to comment.