From 8657e8f43b2f24316929643cc26dee87cc5b7f7f Mon Sep 17 00:00:00 2001 From: yhoogstrate Date: Wed, 30 Oct 2019 17:01:27 +0100 Subject: [PATCH] sav --- src/lsfastafs.cpp | 2 +- src/utils.cpp | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/lsfastafs.cpp b/src/lsfastafs.cpp index daeb2725..9fd654a4 100644 --- a/src/lsfastafs.cpp +++ b/src/lsfastafs.cpp @@ -62,7 +62,7 @@ std::unordered_multimap > get_f std::string basename = basename_cpp(fn); //std::string basename = std::filesystem::path(fn).filename(); - std::cout << "basename: " << basename << "\n"; + //std::cout << "basename: " << basename << "\n"; std::string dict_fn = std::string(mount_dir) + "/" + basename + ".dict"; diff --git a/src/utils.cpp b/src/utils.cpp index 0c8c8601..446ad08c 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -176,29 +176,28 @@ bool is_fasta_file(char *filename) // https://www.systutorials.com/241216/how-to-get-the-directory-path-and-file-name-from-a-absolute-path-in-c-on-linux/ // https://stackoverflow.com/questions/38456127/what-is-the-value-of-cplusplus-for-c17 - THEN use std::filesystem::path(filename).filename(); std::string basename_cpp(std::string fn) { - //char* ts1 = strdup(local_file); - char* ts2 = strdup(fn.c_str()); + char* ts = strdup(fn.c_str()); //char* dir = dirname(ts1); - char* filename = basename(ts2); - std::string filenamepp = std::string(filename); + char* filename = basename(ts); + //std::string filenamepp = std::string(filename); - printf("basename: [%s]\n", filename); - std::cout << "basenamepp: |" << filenamepp << "|\n"; + //printf("basename: [%s]\n", filename); + //std::cout << "basenamepp: |" << filenamepp << "|\n"; - return filenamepp; + return std::string(filename); } // https://www.linuxquestions.org/questions/programming-9/how-to-get-the-full-path-of-a-file-in-c-841046/ // https://stackoverflow.com/questions/38456127/what-is-the-value-of-cplusplus-for-c17 - THEN use std::filesystem::canonical(filename) std::string realpath_cpp(std::string fn) { - std::string out = "asd"; + //std::string out = "asd"; char *path = realpath(fn.c_str(), NULL); - printf("realpath: [%s]\n", path); + //printf("realpath: [%s]\n", path); - std::string realpathpp = std::string(path); - std::cout << "realpath: |" << realpathpp << "|\n"; + //std::string realpathpp = std::string(path); + //std::cout << "realpath: |" << realpathpp << "|\n"; - return realpathpp; + return std::string(path); }