Commit 88044a01 authored by Marc Duez's avatar Marc Duez

vidjil.cpp : force current working directory to be the vidjil program directory

-debug problem with relative path hard-coded in vidjil
-if you want to give a relative path in vidjil command imagine you are at the vidjil root
parent 65d24469
......@@ -8,6 +8,7 @@
#include "kmerstore.h"
#include "stats.h"
using namespace std;
class Germline {
......
......@@ -30,6 +30,8 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
#include <stdio.h>
#include "core/tools.h"
#include "core/json.h"
......@@ -292,6 +294,17 @@ int main (int argc, char **argv)
//JsonArray which contains the Levenshtein distances
JsonArray jsonLevenshtein;
//replace working directory to avoid relative path problem
char dest[PATH_MAX];
char path[PATH_MAX] = "/proc/self/exe";
if (readlink(path, dest, PATH_MAX) == -1)
perror("readlink");
string dest2(dest);
string dest3 = dest2.substr(0, dest2.find_last_of("\\/"));
cout << chdir(dest3.c_str())<<endl;
//$$ options: getopt
while ((c = getopt(argc, argv, "AhagG:V:D:J:k:r:vw:e:C:t:l:dc:m:M:N:s:p:Sn:o:L%:Z:y:z:uU")) != EOF)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment