Exemple #1
0
bool CamuleDlg::Check_and_Init_Skin()
{
	bool ret = true;
	wxString skinFileName(thePrefs::GetSkin());

	if (skinFileName.IsEmpty() || skinFileName.IsSameAs(_("- default -"))) {
		return false;
	}

	wxString userDir(JoinPaths(GetConfigDir(), wxT("skins")) + wxFileName::GetPathSeparator());

	wxStandardPathsBase &spb(wxStandardPaths::Get());
#ifdef __WINDOWS__ 
	wxString dataDir(spb.GetPluginsDir());
#elif defined(__WXMAC__)
		wxString dataDir(spb.GetDataDir());
#else
	wxString dataDir(spb.GetDataDir().BeforeLast(wxT('/')) + wxT("/amule"));
#endif
	wxString systemDir(JoinPaths(dataDir,wxT("skins")) + wxFileName::GetPathSeparator());


	skinFileName.Replace(wxT("User:"******"System:"), systemDir );

	m_skinFileName.Assign(skinFileName);
	if (!m_skinFileName.FileExists()) {
		AddLogLineC(CFormat(
			_("Skin directory '%s' does not exist")) %
			skinFileName );
		ret = false;
	} else if (!m_skinFileName.IsFileReadable()) {
		AddLogLineC(CFormat(
			_("WARNING: Unable to open skin file '%s' for read")) %
			skinFileName);
		ret = false;
	}

	wxFFileInputStream in(m_skinFileName.GetFullPath());
	wxZipInputStream zip(in);
	wxZipEntry *entry;

	while ((entry = zip.GetNextEntry()) != NULL) {
		wxZipEntry*& current = cat[entry->GetInternalName()];
		delete current;
		current = entry;
	}

	return ret;
}
bool QMakeSourceFileInfo::isSystemInclude(const QString &name)
{
    if (QDir::isRelativePath(name)) {
        // if we got a relative path here, it's either an -I flag with a relative path
        // or an include file we couldn't locate. Either way, conclude it's not
        // a system include.
        return false;
    }

    for (int i = 0; i < systemIncludes.size(); ++i) {
        // check if name is located inside the system include dir:
        QDir systemDir(systemIncludes.at(i));
        QString relativePath = systemDir.relativeFilePath(name);

        // the relative path might be absolute if we're crossing drives on Windows
        if (QDir::isAbsolutePath(relativePath) || relativePath.startsWith("../"))
            continue;
        debug_msg(5, "File/dir %s is in system dir %s, skipping",
                  qPrintable(name), qPrintable(systemIncludes.at(i)));
        return true;
    }
    return false;
}