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
|
||||
DWORD s,d;
|
||||
int alloced=0;
|
||||
char *path=line.gettoken_str(1);
|
||||
if (!((*path == '\\' && path[1] == '\\') || (*path && path[1] == ':'))) {
|
||||
size_t pathlen=strlen(path)+GetCurrentDirectory(0, buf)+2;
|
||||
char *nrpath=(char *)malloc(pathlen);
|
||||
alloced=1;
|
||||
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;
|
||||
}
|
||||
}
|
||||
char *upath=line.gettoken_str(1);
|
||||
char path[1024];
|
||||
char *name;
|
||||
path[0] = 0;
|
||||
GetFullPathName(upath, 1024, path, &name);
|
||||
s=GetFileVersionInfoSize(path,&d);
|
||||
if (s)
|
||||
{
|
||||
|
@ -4715,7 +4693,6 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
GlobalFree(buf);
|
||||
}
|
||||
}
|
||||
if (alloced) free(path);
|
||||
#else
|
||||
FILE *fdll = FOPEN(line.gettoken_str(1), "rb");
|
||||
if (!fdll) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue