Esempio n. 1
0
void WinFilePath::setString(const TCHAR *string)
{
  StringStorage str(string);
  if (!str.isEmpty()) {
    if (str.findLast('/') == 0) {
      m_parentPathIsRoot = true;
    }
    str.replaceChar(_T('/'), _T('\\'));
    if (str.beginsWith(_T('\\'))) {
      str.remove(0, 1);
    }
    if (str.endsWith(_T('\\'))) {
      str.truncate(1);
    }
  }
  // desktop replacement
//TCHAR path[MAX_PATH + 1];

	StringStorage specFolder;
	str.getSubstring(&specFolder,0,8);

	if(specFolder.isEqualTo(_T("[Desktop]"))){
		StringStorage tmp;
		str.getSubstring(&tmp,9,str.getLength());
		Environment::getSpecialFolderPath(Environment::USERDESKTOP_DATA_SPECIAL_FOLDER, &specFolder);
		str.setString(specFolder.getString());
		str.appendString(tmp.getString());
  }
	
	str.getSubstring(&specFolder,0,5);

	if(specFolder.isEqualTo(_T("[Docs]"))){
		StringStorage tmp;
		str.getSubstring(&tmp,6,str.getLength());
		Environment::getSpecialFolderPath(Environment::USERDOCS_DATA_SPECIAL_FOLDER, &specFolder);
		str.setString(specFolder.getString());
		str.appendString(tmp.getString());
	}



  StringStorage::setString(str.getString());
}
Esempio n. 2
0
bool ViewerCmdLine::isHelpPresent()
{
  for (size_t i = 0; i < m_wpcl.getArgumentsCount(); i++) {
    StringStorage argument;
    if (m_wpcl.getArgument(i, &argument)) {
      if (argument.isEqualTo(HELP_ARG))
        return true;
      if (argument.isEqualTo(HELP_ARG_SHORT))
        return true;
      if (argument.isEqualTo(HELP_ARG_QUESTION))
        return true;
    }
  }

  if (isPresent(HELP))
    return true;
  if (isPresent(HELP_SHORT))
    return true;
  return false;
}
bool IniFileSettingsManager::keyExist(const TCHAR *name)
{
  //
  // To determinate key exists or not, place some non-standart default text
  // to default value of GetPrivateProfileString and if output returns is equals
  // to default, then key does not exists.
  //

  StringStorage value;

  // FIXME: Use random generated string instead of static text
  const TCHAR * defaultValue = _T("_Ini_File_Key_Does_Not_Exist_Test");

  getPrivateProfileString(name, &value, defaultValue);

  if (value.isEqualTo(defaultValue)) {
    return false;
  }
  return true;
}