1 : /**********************************************************************
2 : * $Id: cpl_getexecpath.cpp 10645 2007-01-18 02:22:39Z warmerdam $
3 : *
4 : * Project: CPL - Common Portability Library
5 : * Purpose: Implement CPLGetExecPath().
6 : * Author: Frank Warmerdam, warmerdam@pobox.com
7 : *
8 : **********************************************************************
9 : * Copyright (c) 2005, Frank Warmerdam
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 : * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #include "cpl_conv.h"
31 :
32 : CPL_CVSID("$Id: cpl_getexecpath.cpp 10645 2007-01-18 02:22:39Z warmerdam $");
33 :
34 : #if defined(WIN32) || defined(WIN32CE)
35 :
36 : #if defined(WIN32CE)
37 : # include "cpl_win32ce_api.h"
38 : #else
39 : # include <windows.h>
40 : #endif
41 :
42 : /************************************************************************/
43 : /* CPLGetExecPath() */
44 : /************************************************************************/
45 :
46 : int CPLGetExecPath( char *pszPathBuf, int nMaxLength )
47 : {
48 : #ifndef WIN32CE
49 : if( GetModuleFileName( NULL, pszPathBuf, nMaxLength ) == 0 )
50 : #else
51 : if( CE_GetModuleFileNameA( NULL, pszPathBuf, nMaxLength ) == 0 )
52 : #endif
53 : return FALSE;
54 : else
55 : return TRUE;
56 : }
57 :
58 : #else /* ndef WIN32 */
59 :
60 : /************************************************************************/
61 : /* CPLGetExecPath() */
62 : /************************************************************************/
63 :
64 : /**
65 : * Fetch path of executable.
66 : *
67 : * The path to the executable currently running is returned. This path
68 : * includes the name of the executable. Currently this only works on
69 : * win32 platform.
70 : *
71 : * @param pszPathBuf the buffer into which the path is placed.
72 : * @param nMaxLength the buffer size, MAX_PATH+1 is suggested.
73 : *
74 : * @return FALSE on failure or TRUE on success.
75 : */
76 :
77 0 : int CPLGetExecPath( char *pszPathBuf, int nMaxLength )
78 :
79 : {
80 0 : return FALSE;
81 : }
82 : #endif
83 :
|