Clone
ixen <ixen@copyhandler.com>
committed
on 25 Jan 16
LoggerImprovements + 5 more
src/ch/AppHelper.cpp (+20 -23)
134 134         else
135 135                 return uiLen;
136 136 }
137 137
138 138 // expands given path
139 139 CString CAppHelper::ExpandPath(CString strPath)
140 140 {
141 141         // check if there is need to perform all these checkings
142 142         if (strPath[0] != _T('<'))
143 143                 return strPath;
144 144
145 145         TCHAR szStr[ _MAX_PATH ];
146 146         szStr[ 0 ] = _T('\0');
147 147
148 148         // search for string to replace
149 149         // _T("<WINDOWS>"), _T("<TEMP>"), _T("<SYSTEM>"), _T("<APPDATA>"), _T("<DESKTOP>"),
150 150         // _T("<PERSONAL>"), _T("<PROGRAM>")
151 151         if (_tcsnicmp(strPath, _T("<PROGRAM>"), 9) == 0)
152 152         {
153 153                 // get windows path
154                   _tcsncpy(szStr, m_pszProgramPath ? m_pszProgramPath : _t(""), _MAX_PATH);
  154                 _tcsncpy(szStr, m_pszProgramPath ? m_pszProgramPath : _T(""), _MAX_PATH);
155 155                 szStr[_MAX_PATH - 1] = _T('\0');
156 156                 _tcsncat(szStr, strPath.Mid(9), _MAX_PATH - _tcslen(szStr));
157 157                 szStr[_MAX_PATH - 1] = _T('\0');
158 158         }
159 159         else if (_tcsnicmp(strPath, _T("<WINDOWS>"), 9) == 0)
160 160         {
161 161                 // get windows path
162 162                 UINT uiSize=GetWindowsDirectory(szStr, _MAX_PATH);
163 163                 if (szStr[uiSize-1] == _T('\\'))
164 164                         szStr[uiSize-1]=_T('\0');
165 165                 _tcsncat(szStr, strPath.Mid(9), _MAX_PATH - uiSize);
166 166                 szStr[_MAX_PATH - 1] = _T('\0');
167 167         }
168 168         else if (_tcsnicmp(strPath, _T("<TEMP>"), 6) == 0)      // temp dir
169 169         {
170 170                 // get windows path
171 171                 UINT uiSize=GetTempPath(_MAX_PATH, szStr);
172 172                 if (szStr[uiSize-1] == _T('\\'))
173 173                         szStr[uiSize-1]=_T('\0');
174 174                 _tcsncat(szStr, strPath.Mid(6), _MAX_PATH - uiSize);