template<typename CharType> static PathName UnmangleNameOfFile_(const CharType* lpszFrom) { PathName ret; char* lpszTo = ret.GetData(); MIKTEX_ASSERT_STRING(lpszFrom); size_t len = StrLen(lpszFrom); if (len >= ret.GetCapacity()) { MIKTEX_UNEXPECTED(); } size_t idx; for (idx = 0; idx < len; ++idx) { if (lpszFrom[idx] == '*') { lpszTo[idx] = ' '; } else if (lpszFrom[idx] == '?') { lpszTo[idx] = '~'; } else { lpszTo[idx] = lpszFrom[idx]; } } lpszTo[idx] = 0; return ret; }
PathName WebAppInputLine::MangleNameOfFile(const char* lpszFrom) { PathName ret; char* lpszTo = ret.GetData(); MIKTEX_ASSERT_STRING(lpszFrom); size_t len = StrLen(lpszFrom); if (len >= ret.GetCapacity()) { MIKTEX_UNEXPECTED(); } size_t idx; for (idx = 0; idx < len; ++idx) { if (lpszFrom[idx] == ' ') { lpszTo[idx] = '*'; } else if (lpszFrom[idx] == '~') { lpszTo[idx] = '?'; } else if (lpszFrom[idx] == '\\') { lpszTo[idx] = '/'; } else { lpszTo[idx] = lpszFrom[idx]; } } lpszTo[idx] = 0; return ret; }
bool Utils::GetEnvironmentString (/*[in]*/ const char * lpszName, /*[out]*/ PathName & path) { return (Utils::GetEnvironmentString(lpszName, path.GetBuffer(), path.GetCapacity())); }