mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-24 02:35:20 +00:00
77b9dbd557
* src/LaTeX.C (LaTeX::deplog): Assume that filenames in log files are stored in the file system encoding * src/frontends/qt4/qt_helpers.[Ch] (internal_path): delete * src/frontends/qt4/QGraphics.C: Adjust to change above * src/frontends/qt4/QPrefsDialog.C: ditto * src/frontends/qt4/QExternal.C: ditto * src/frontends/qt4/QInclude.C: ditto * src/support/os.h: Document the encoding of filename arguments * src/support/os_win32.h: ditto * src/support/filetools.C (findtexfile): Convert filename from file system encoding * src/support/os_win32.C: Convert filenames from utf8 to file system encoding and vice versa where needed * src/support/os_cygwin.C: ditto * src/support/getcwd.C (getcwd): Use internal_path() with correct encoding * src/support/docstring.[Ch] (from_filesystem8bit): new conversion function * src/support/environment.C (getEnv): convert environment variable from local 8bit encoding to utf8 (setEnv): convert environment variable from utf8 to local 8bit encoding * src/support/environment.h: document encoding of function arguments git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16753 a592a061-630c-0410-9148-cb99ea01b6c8
92 lines
2.4 KiB
C++
92 lines
2.4 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file os_win32.h
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Angus Leeming
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*
|
|
* These classes should be used only on Windows machines.
|
|
*/
|
|
|
|
#ifndef OS_WIN32_H
|
|
#define OS_WIN32_H
|
|
|
|
#include <string>
|
|
|
|
#if !defined(_WIN32)
|
|
# error os_win32.h should be compiled only under Windows.
|
|
#endif
|
|
|
|
/* The GetLongPathNameA function declaration in
|
|
* <winbase.h> is protected by the WINVER macro which is
|
|
* defined to a default value in <windef.h> under MinGW and Cygwin.
|
|
*
|
|
* SHGFP_TYPE_CURRENT is defined in <shlobj.h> for __W32API_VERSION >= 3.2
|
|
* where it is protected by _WIN32_IE, also defined to a default value
|
|
* in <windef.h> under MinGW and Cygwin.
|
|
* It is missing in earlier versions of the MinGW w32api headers.
|
|
*
|
|
* We need to #include <windows.h> now to make available the
|
|
* DWORD, HMODULE et al. typedefs, so first define WINVER, _WIN32_IE.
|
|
*
|
|
* Note: __CYGWIN__ can be defined here if building in _WIN32 mode.
|
|
*/
|
|
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__CYGWIN32__)
|
|
# if defined(WINVER) && WINVER < 0x0500
|
|
# error WINVER must be >= 0x0500
|
|
# endif
|
|
# define WINVER 0x0500
|
|
# define _WIN32_IE 0x0500
|
|
#endif
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
namespace lyx {
|
|
namespace support {
|
|
namespace os {
|
|
|
|
/** Win98 and earlier don't have SHGetFolderPath in shell32.dll.
|
|
* Microsoft recommend that we load shfolder.dll at run time and
|
|
* access the function through that.
|
|
*
|
|
* shfolder.dll is loaded dynamically in the constructor. If loading
|
|
* fails or if the .dll is found not to contain SHGetFolderPathA then
|
|
* the program exits immediately. Otherwise, the .dll is unloaded in
|
|
* the destructor
|
|
*
|
|
* The class makes SHGetFolderPath available through its function operator.
|
|
* It will work on all versions of Windows >= Win95.
|
|
*/
|
|
class GetFolderPath {
|
|
public:
|
|
enum folder_id {
|
|
/// CSIDL_PERSONAL
|
|
PERSONAL,
|
|
/// CSIDL_APPDATA
|
|
APPDATA
|
|
};
|
|
|
|
GetFolderPath();
|
|
~GetFolderPath();
|
|
|
|
/** Wrapper for SHGetFolderPathA, returning
|
|
* the path asscociated with @c id in utf8 encoding.
|
|
*/
|
|
std::string const operator()(folder_id id) const;
|
|
private:
|
|
typedef HRESULT (__stdcall * function_pointer)(HWND, int, HANDLE, DWORD, LPCSTR);
|
|
|
|
HMODULE folder_module_;
|
|
function_pointer folder_path_func_;
|
|
};
|
|
|
|
} // namespace os
|
|
} // namespace support
|
|
} // namespace lyx
|
|
|
|
#endif // OS_WIN32_H
|