From ee27bc04fc1f0cdd7aa04a65d6bef7662ade7264 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 20 Apr 2007 23:46:05 +0000 Subject: [PATCH] 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 --- Source/script.cpp | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/Source/script.cpp b/Source/script.cpp index db94ae0f..d906430e 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -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) {