Skip to content

Commit

Permalink
fix for bcalm when -out points to another directory. Also did a minor…
Browse files Browse the repository at this point in the history
… change in Bank, hopefully inconsequential
  • Loading branch information
Rayan Chikhi committed Dec 16, 2016
1 parent def82f1 commit 11a2aa1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion gatb-core/src/gatb/bank/impl/Bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,12 @@ IBank* Bank::_open_ (const std::string& uri)
{
result = it->factory->createBank(uri);
DEBUG ((" factory '%s' => result=%p \n", it->name.c_str(), result ));

if (result) // if one of the factories produce a result, we can just stop, no need to try other factories.
break;
}

if (result == 0) { throw system::Exception ("Unable to open bank '%s'", uri.c_str()); }
if (result == 0) { throw system::Exception ("Unable to open bank '%s' (if it is a list of files, perhaps some of the files inside don't exist)", uri.c_str()); }

return result;
}
Expand Down
8 changes: 7 additions & 1 deletion gatb-core/src/gatb/bcalm2/bcalm_algo.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "bcalm_algo.hpp"
#include <libgen.h> // for basename()

/*
* some notes: this code could be further optimized.
Expand Down Expand Up @@ -594,7 +595,12 @@ void bcalm2(Storage *storage,
std::ofstream list_of_glues(prefix + ".glue");
for (unsigned int i = 0; i < (unsigned int)nb_threads; i++)
{
string glue_file = prefix + ".glue." + std::to_string(i);

char* prefix_copy = strdup (prefix.c_str());
std::string prefix_base (basename(prefix_copy)); // posix basename() may alter the string
free (prefix_copy);

string glue_file = prefix_base + ".glue." + std::to_string(i);
if (nb_seqs_in_glue[i])
{
list_of_glues << glue_file << endl;
Expand Down
2 changes: 1 addition & 1 deletion gatb-core/src/gatb/system/impl/FileSystemCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ IFileSystem::Path FileSystemCommon::getTemporaryDirectory ()
** INPUT :
** OUTPUT :
** RETURN :
** REMARKS :
** REMARKS : Warning! this method isn't exactly basename() as you'd expect in C++. It returns the base name but cuts everything after the last dot.
*********************************************************************/
IFileSystem::Path FileSystemCommon::getBaseName (const Path& path, bool cutToFirstDot)
{
Expand Down

0 comments on commit 11a2aa1

Please sign in to comment.