Ejemplo n.º 1
0
/*!
  This function returns the absolute path to the directory specified
  in the desired key.  In other words, if you want the path to the
  spelling files, you can't just get the prefs value, since that path
  isn't always absolute.  This function gives it to you in absolute
  terms.  
  \param bAppSpecific Is this key specific to the app, or is it
  general to AbiSuite?
  \param szKey A string of gchars representing the desired key
  \param pszValue pointer for the value to be returned in. 
  \return True if successful, false otherwise.  
  \todo support meaningful return values.
*/
bool AP_UnixApp::getPrefsValueDirectory(bool bAppSpecific,
										const gchar * szKey, const gchar ** pszValue) const
{
    if (!m_prefs)
		return false;

    const gchar * psz = NULL;
    if (!m_prefs->getPrefsValue(szKey,&psz))
		return false;

    if (*psz == '/')
    {
		*pszValue = psz;
		return true;
    }

    const gchar * dir = ((bAppSpecific) ? getAbiSuiteAppDir() : getAbiSuiteLibDir());

    static gchar buf[1024];
    UT_ASSERT((strlen(dir) + strlen(psz) + 2) < sizeof(buf));
	
    sprintf(buf,"%s/%s",dir,psz);
    *pszValue = buf;
    return true;
}
Ejemplo n.º 2
0
bool AP_Win32App::getPrefsValueDirectory(bool bAppSpecific,
											const gchar * szKey, const gchar ** pszValue) const
{
	if (!m_prefs)
		return false;

	const gchar * psz = NULL;
	if (!m_prefs->getPrefsValue(szKey,&psz))
		return false;

	if ((*psz == '/') || (*psz == '\\'))
	{
		*pszValue = psz;
		return true;
	}

	const gchar * dir = ((bAppSpecific) ? getAbiSuiteAppDir() : getAbiSuiteLibDir());

	static gchar buf[1024];
	UT_return_val_if_fail ((strlen(dir) + strlen(psz) + 2) < sizeof(buf), false);
	
	sprintf(buf,"%s\\%s",dir,psz);
	*pszValue = buf;
	return true;
}
bool XAP_App::findAbiSuiteAppFile(UT_String & path, const char * filename, const char * subdir) 
{
	if (!filename) 
	{
		return false;
	}

	bool bFound = false;

	const char * dir = getAbiSuiteAppDir();
	if (dir)
	{
		path = dir;
		if (subdir)
		{
			path += G_DIR_SEPARATOR;
			path += subdir;
		}
		path += G_DIR_SEPARATOR;
		path += filename;
		bFound = UT_isRegularFile (path.c_str ());
	}
	return bFound;
}