source: dev/trunk/jenga/include/common/Environment.h@ 189

Last change on this file since 189 was 164, checked in by dai_9181, 17 years ago
File size: 681 bytes
RevLine 
[164]1#pragma once
2#pragma warning(disable : 4996)
3
4#include <vector>
5#include <string>
6
7#include <stdlib.h>
8
9#include <windows.h>
10
11
12namespace Jenga{
13namespace Common{
14
15
16class Environment
17{
18public:
19 static const std::string &GetAppDir()
20 {
21 static std::string appDir;
22 if( appDir.size() == 0 )
23 {
24 char temporary[MAX_PATH];
25 char temp2[MAX_PATH];
26 char temp3[MAX_PATH];
27 GetModuleFileName(GetModuleHandle(0),temporary,MAX_PATH);
28 _splitpath(temporary,temp2,temp3,NULL,NULL);
29 if( temp3[lstrlen(temp3)-1]=='\\' )
30 {
31 temp3[lstrlen(temp3)-1] = 0;
32 }
33 lstrcat(temp2,temp3);
34
35 appDir = temp2;
36 }
37 return appDir;
38 }
39};
40
41
42}}
Note: See TracBrowser for help on using the repository browser.