use GetFullPathName instead of manually adding the working directory
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5112 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f44be03eeb
commit
ee27bc04fc
1 changed files with 5 additions and 28 deletions
|
@ -4670,33 +4670,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD s,d;
|
DWORD s,d;
|
||||||
int alloced=0;
|
int alloced=0;
|
||||||
char *path=line.gettoken_str(1);
|
char *upath=line.gettoken_str(1);
|
||||||
if (!((*path == '\\' && path[1] == '\\') || (*path && path[1] == ':'))) {
|
char path[1024];
|
||||||
size_t pathlen=strlen(path)+GetCurrentDirectory(0, buf)+2;
|
char *name;
|
||||||
char *nrpath=(char *)malloc(pathlen);
|
path[0] = 0;
|
||||||
alloced=1;
|
GetFullPathName(upath, 1024, path, &name);
|
||||||
GetCurrentDirectory(pathlen, nrpath);
|
|
||||||
if (path[0] != '\\')
|
|
||||||
strcat(nrpath,"\\");
|
|
||||||
else if (nrpath[1] == ':') {
|
|
||||||
nrpath[2]=0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
char *p=nrpath+2;
|
|
||||||
while (*p!='\\') p++;
|
|
||||||
*p=0;
|
|
||||||
}
|
|
||||||
strcat(nrpath,path);
|
|
||||||
FILE *f=FOPEN(nrpath, "r");
|
|
||||||
if (f) {
|
|
||||||
path=nrpath;
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
free(nrpath);
|
|
||||||
alloced=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s=GetFileVersionInfoSize(path,&d);
|
s=GetFileVersionInfoSize(path,&d);
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
|
@ -4715,7 +4693,6 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
GlobalFree(buf);
|
GlobalFree(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (alloced) free(path);
|
|
||||||
#else
|
#else
|
||||||
FILE *fdll = FOPEN(line.gettoken_str(1), "rb");
|
FILE *fdll = FOPEN(line.gettoken_str(1), "rb");
|
||||||
if (!fdll) {
|
if (!fdll) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue