Skip to content

Commit

Permalink
sav
Browse files Browse the repository at this point in the history
  • Loading branch information
yhoogstrate committed Oct 30, 2019
1 parent 20dc71d commit 8657e8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/lsfastafs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::unordered_multimap<std::string, std::pair<std::string, std::string> > 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";

Expand Down
23 changes: 11 additions & 12 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 8657e8f

Please sign in to comment.