diff options
| author | Tharre <tharre3@gmail.com> | 2015-02-20 21:51:26 +0100 | 
|---|---|---|
| committer | Tharre <tharre3@gmail.com> | 2015-02-20 21:51:26 +0100 | 
| commit | 91bef81e00a7e289509125686418a97c591eb459 (patch) | |
| tree | d7ac37b357628ae50fa754dd9fffc2dc9ccde358 | |
| parent | 575dcfc9e15cfbd45339fe0e5cb4be6c637248d1 (diff) | |
| download | redo-91bef81e00a7e289509125686418a97c591eb459.tar.gz redo-91bef81e00a7e289509125686418a97c591eb459.tar.xz redo-91bef81e00a7e289509125686418a97c591eb459.zip  | |
Always use the CWD of the dofile, not the target
| -rw-r--r-- | src/build.c | 15 | 
1 files changed, 5 insertions, 10 deletions
diff --git a/src/build.c b/src/build.c index 71f10f9..6761bfd 100644 --- a/src/build.c +++ b/src/build.c @@ -112,19 +112,14 @@ int build_target(const char *target) {  		/* child */  		/* change directory to our target */ -		char *dirc = xstrdup(target); -		char *dtarget = dirname(dirc); -		if (chdir(dtarget) == -1) -			fatal("redo: failed to change directory to %s", dtarget); +		char *dirc = xstrdup(dofiles->chosen); +		char *ddofile = dirname(dirc); +		if (chdir(ddofile) == -1) +			fatal("redo: failed to change directory to %s", ddofile);  		free(dirc); -		/* target is now in the cwd so change path accordingly */ -		char *btarget = xbasename(target); -		char *bdo_file = xbasename(dofiles->chosen); -		char *btemp_output = xbasename(temp_output); - -		char **argv = parse_shebang(btarget, bdo_file, btemp_output); +		char **argv = parse_shebang((char*)target, dofiles->chosen, temp_output);  		/* set "REDO_PARENT_TARGET" */  		if (setenv("REDO_PARENT_TARGET", target, 1))  | 
