From 9b15ba192b8ca030f97eb1ba69f032ae5458df41 Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 17 Apr 2007 18:30:30 +0000 Subject: [PATCH] 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 --- Contrib/Library/LibraryLocal/LibraryLocal.cpp | 59 ++++--------------- Contrib/Library/LibraryLocal/SConscript | 8 ++- 2 files changed, 18 insertions(+), 49 deletions(-) diff --git a/Contrib/Library/LibraryLocal/LibraryLocal.cpp b/Contrib/Library/LibraryLocal/LibraryLocal.cpp index aba75ba1..d0b6d8e7 100644 --- a/Contrib/Library/LibraryLocal/LibraryLocal.cpp +++ b/Contrib/Library/LibraryLocal/LibraryLocal.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include "../../../Source/ResourceEditor.h" #include "../../../Source/ResourceVersionInfo.h" @@ -19,6 +18,10 @@ 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 found = 0; @@ -87,8 +90,13 @@ int GetTLBVersion(string& filepath, DWORD& high, DWORD & low) int found = 0; + char fullpath[1024]; + char *p; + if (!GetFullPathName(filepath.c_str(), sizeof(fullpath), fullpath, &p)) + return 0; + 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; HRESULT hr; @@ -144,50 +152,9 @@ int main(int argc, char* argv[]) mode = argv[1]; 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 - ifstream fs(filepath.c_str()); + ifstream fs(filename.c_str()); if (fs.is_open()) { @@ -210,7 +177,7 @@ int main(int argc, char* argv[]) 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) { - versionfound = GetTLBVersion(filepath, high, low); + versionfound = GetTLBVersion(filename, high, low); } diff --git a/Contrib/Library/LibraryLocal/SConscript b/Contrib/Library/LibraryLocal/SConscript index 7a271a91..8e5b7471 100644 --- a/Contrib/Library/LibraryLocal/SConscript +++ b/Contrib/Library/LibraryLocal/SConscript @@ -3,15 +3,17 @@ target = 'LibraryLocal' files = Split(""" LibraryLocal.cpp #Source/ResourceEditor.cpp + #Source/util.cpp #Source/winchar.cpp """) libs = Split(""" - kernel32 oleaut32 - version """) -Import('BuildUtil') +Import('BuildUtil env') + +if env['PLATFORM'] != 'win32': + libs = [] BuildUtil(target, files, libs, flags = ['$EXCEPTION_FLAG'], cross_platform = True)