fixed bug #1701879 - linux LibraryLocal FTBFS

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5095 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-04-17 18:30:30 +00:00
parent 22a81bc536
commit 9b15ba192b
2 changed files with 18 additions and 49 deletions

View file

@ -11,7 +11,6 @@
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <direct.h>
#include "../../../Source/ResourceEditor.h" #include "../../../Source/ResourceEditor.h"
#include "../../../Source/ResourceVersionInfo.h" #include "../../../Source/ResourceVersionInfo.h"
@ -19,6 +18,10 @@
using namespace std; using namespace std;
int g_noconfig=0;
int g_display_errors=1;
FILE *g_output=stdout;
int GetDLLVersion(string& filepath, DWORD& high, DWORD & low) int GetDLLVersion(string& filepath, DWORD& high, DWORD & low)
{ {
int found = 0; int found = 0;
@ -87,8 +90,13 @@ int GetTLBVersion(string& filepath, DWORD& high, DWORD & low)
int found = 0; int found = 0;
char fullpath[1024];
char *p;
if (!GetFullPathName(filepath.c_str(), sizeof(fullpath), fullpath, &p))
return 0;
wchar_t ole_filename[1024]; wchar_t ole_filename[1024];
MultiByteToWideChar(CP_ACP, 0, filepath.c_str(), filepath.length() + 1, ole_filename, 1024); MultiByteToWideChar(CP_ACP, 0, fullpath, lstrlen(fullpath) + 1, ole_filename, 1024);
ITypeLib* typeLib; ITypeLib* typeLib;
HRESULT hr; HRESULT hr;
@ -144,50 +152,9 @@ int main(int argc, char* argv[])
mode = argv[1]; mode = argv[1];
filename = argv[2]; filename = argv[2];
char buf[1024];
getcwd(buf, 1024);
filepath = buf;
if ((filename.substr(0, 1).compare("\\") != 0) && (filename.substr(1, 1).compare(":") != 0)) {
// Path is relative
if (filepath.substr(filepath.length() - 1, 1).compare("\\") != 0)
filepath.append("\\");
filepath.append(filename);
} else if ((filename.substr(0, 1).compare("\\") == 0) && (filename.substr(1, 1).compare("\\") != 0)) {
// Path is relative to current root
if (filepath.substr(1, 1).compare(":") == 0) {
// Standard path
filepath = filepath.substr(0, filepath.find('\\'));
filepath.append(filename);
} else {
// UNC path
filepath = filepath.substr(0, filepath.find('\\', filepath.find('\\', 2) + 1));
filepath.append(filename);
}
} else {
// Absolute path
filepath = filename;
}
// Validate filename // Validate filename
ifstream fs(filepath.c_str()); ifstream fs(filename.c_str());
if (fs.is_open()) if (fs.is_open())
{ {
@ -210,7 +177,7 @@ int main(int argc, char* argv[])
if (mode.compare("D") == 0) if (mode.compare("D") == 0)
{ {
versionfound = GetDLLVersion(filepath, high, low); versionfound = GetDLLVersion(filename, high, low);
} }
@ -219,7 +186,7 @@ int main(int argc, char* argv[])
if (mode.compare("T") == 0) if (mode.compare("T") == 0)
{ {
versionfound = GetTLBVersion(filepath, high, low); versionfound = GetTLBVersion(filename, high, low);
} }

View file

@ -3,15 +3,17 @@ target = 'LibraryLocal'
files = Split(""" files = Split("""
LibraryLocal.cpp LibraryLocal.cpp
#Source/ResourceEditor.cpp #Source/ResourceEditor.cpp
#Source/util.cpp
#Source/winchar.cpp #Source/winchar.cpp
""") """)
libs = Split(""" libs = Split("""
kernel32
oleaut32 oleaut32
version
""") """)
Import('BuildUtil') Import('BuildUtil env')
if env['PLATFORM'] != 'win32':
libs = []
BuildUtil(target, files, libs, flags = ['$EXCEPTION_FLAG'], cross_platform = True) BuildUtil(target, files, libs, flags = ['$EXCEPTION_FLAG'], cross_platform = True)