X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=development%2FWin32%2Fpackage.C;h=fd92e5cea260f8c230fc94e706649ac41bb166ca;hb=7afbc908eb0d6d412e3e5e03fae92ca0472a76d6;hp=76b8b0953444a768f9866767fb70e3e08929dd0a;hpb=d099468f67b82377a340d9697f5bf2ea3d305455;p=lyx.git diff --git a/development/Win32/package.C b/development/Win32/package.C index 76b8b09534..fd92e5cea2 100644 --- a/development/Win32/package.C +++ b/development/Win32/package.C @@ -38,6 +38,24 @@ #endif #if defined (USE_WINDOWS_PACKAGING) + +/* + * MinGW's version of winver.h contains this comment: + * + * If you need Win32 API features newer the Win95 and WinNT then you must + * define WINVER before including windows.h or any other method of including + * the windef.h header. + * + * GetLongPathNameA requires WINVER == 0x0500. + * + * It doesn't matter if the Windows version is older than this because the + * function will compile but will fail at run time. See + * http://msdn.microsoft.com/library/en-us/mslu/winprog/microsoft_layer_for_unicode_apis_with_limited_support.asp + */ +# if defined(__MINGW32__) +# define WINVER 0x0500 +# endif + # include # include // SHGetFolderPath @@ -363,6 +381,7 @@ string const get_temp_dir() // Typical example: C:/TEMP/. char path[MAX_PATH + 1]; GetTempPath(MAX_PATH, path); + GetLongPathName(path, path, MAX_PATH + 1); return os::internal_path(path); #else // Posix-like. return "/tmp"; @@ -395,7 +414,12 @@ string const abs_path_from_command_line(string const & command_line) // Does the grunt work for abs_path_from_binary_name() string const get_binary_path(string const & exe) { - string const exe_path = os::internal_path(exe); + // The executable may have been invoked either with or + // without the .exe extension. + // Ensure that it is present. + string const as_internal_path = os::internal_path(exe); + string const exe_path = suffixIs(as_internal_path, ".exe") ? + as_internal_path : as_internal_path + ".exe"; if (os::is_absolute_path(exe_path)) return exe_path;