| [164] | 1 | #pragma once
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | namespace Jenga{
 | 
|---|
 | 4 | namespace Common{
 | 
|---|
 | 5 | 
 | 
|---|
| [524] | 6 | #pragma warning(disable : 4996)
 | 
|---|
| [164] | 7 | 
 | 
|---|
 | 8 | class Environment
 | 
|---|
 | 9 | {
 | 
|---|
 | 10 | public:
 | 
|---|
| [480] | 11 |     static const std::string GetCurrentDir()
 | 
|---|
 | 12 |     {
 | 
|---|
 | 13 |         char temp[MAX_PATH];
 | 
|---|
 | 14 |         ::GetCurrentDirectory( MAX_PATH, temp );
 | 
|---|
 | 15 |         return temp;
 | 
|---|
 | 16 |     }
 | 
|---|
 | 17 | 
 | 
|---|
| [164] | 18 |     static const std::string &GetAppDir()
 | 
|---|
 | 19 |     {
 | 
|---|
 | 20 |         static std::string appDir;
 | 
|---|
 | 21 |         if( appDir.size() == 0 )
 | 
|---|
 | 22 |         {
 | 
|---|
 | 23 |             char temporary[MAX_PATH];
 | 
|---|
 | 24 |             char temp2[MAX_PATH];
 | 
|---|
 | 25 |             char temp3[MAX_PATH];
 | 
|---|
 | 26 |             GetModuleFileName(GetModuleHandle(0),temporary,MAX_PATH);
 | 
|---|
 | 27 |             _splitpath(temporary,temp2,temp3,NULL,NULL);
 | 
|---|
 | 28 |             if( temp3[lstrlen(temp3)-1]=='\\' )
 | 
|---|
 | 29 |             {
 | 
|---|
 | 30 |                 temp3[lstrlen(temp3)-1] = 0;
 | 
|---|
 | 31 |             }
 | 
|---|
 | 32 |             lstrcat(temp2,temp3);
 | 
|---|
 | 33 | 
 | 
|---|
 | 34 |             appDir = temp2;
 | 
|---|
 | 35 |         }
 | 
|---|
 | 36 |         return appDir;
 | 
|---|
 | 37 |     }
 | 
|---|
| [477] | 38 | 
 | 
|---|
 | 39 |     static const std::string &GetAppFileName()
 | 
|---|
 | 40 |     {
 | 
|---|
 | 41 |         static std::string appFileName;
 | 
|---|
 | 42 |         if( appFileName.size() == 0 )
 | 
|---|
 | 43 |         {
 | 
|---|
 | 44 |             char temporary[MAX_PATH];
 | 
|---|
 | 45 |             char temp2[MAX_PATH];
 | 
|---|
 | 46 |             char temp3[MAX_PATH];
 | 
|---|
 | 47 |             GetModuleFileName(GetModuleHandle(0),temporary,MAX_PATH);
 | 
|---|
 | 48 |             _splitpath(temporary,NULL,NULL,temp2,temp3);
 | 
|---|
 | 49 |             lstrcat(temp2,temp3);
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 |             appFileName = temp2;
 | 
|---|
 | 52 |         }
 | 
|---|
 | 53 |         return appFileName;
 | 
|---|
 | 54 |     }
 | 
|---|
 | 55 | 
 | 
|---|
 | 56 |     static const std::string &GetAppFilePath()
 | 
|---|
 | 57 |     {
 | 
|---|
 | 58 |         static std::string appFilePath;
 | 
|---|
 | 59 |         if( appFilePath.size() == 0 )
 | 
|---|
 | 60 |         {
 | 
|---|
 | 61 |             char temporary[MAX_PATH];
 | 
|---|
 | 62 |             GetModuleFileName(GetModuleHandle(0),temporary,MAX_PATH);
 | 
|---|
 | 63 | 
 | 
|---|
 | 64 |             appFilePath = temporary;
 | 
|---|
 | 65 |         }
 | 
|---|
 | 66 |         return appFilePath;
 | 
|---|
 | 67 |     }
 | 
|---|
| [164] | 68 | };
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 | 
 | 
|---|
| [205] | 71 | }}
 | 
|---|