示例#1
0
void WebUIServer::FindStyle()
{
    styleRoot_.clear();
    const std::string style = System::GetSettings()->webui.style;
    std::set<std::string> paths;
    paths.insert(System::Home());
    paths.insert("/usr/local/share/sharelin");
    paths.insert("/usr/share/sharelin");
    paths.insert(root_directory);
#ifdef DEFAULT_ROOT
    paths.insert(std::string(DEFAULT_ROOT) + "/share/sharelin");
#endif
    for(std::set<std::string>::iterator i = paths.begin(); i != paths.end(); ++i)
    {
        const std::string s = *i + "/webui/" + style;
        System::LogBas() << "Searching style '" << style << "' in " << s << " => ";
        if(Exists(s))
        {
            styleRoot_ = s;
            System::Log() << "Found" << std::endl;
            //__android_log_write(ANDROID_LOG_DEBUG, "sharelin", "Found");
            break;
        }
        else System::Log() << "Not found" << std::endl;
        //__android_log_write(ANDROID_LOG_DEBUG, "sharelin", "Not found");
    }
}
void AssetDatabase::HandleFileChanged(StringHash eventType, VariantMap& eventData)
{
    using namespace FileChanged;
    const String& fullPath = eventData[P_FILENAME].GetString();

    FileSystem* fs = GetSubsystem<FileSystem>();

    String pathName, fileName, ext;

    SplitPath(fullPath, pathName, fileName, ext);

    // ignore changes in the Cache resource dir
    if (fullPath == GetCachePath() || pathName.StartsWith(GetCachePath()))
        return;

    // don't care about directories and asset file changes
    if (fs->DirExists(fullPath) || ext == ".asset")
        return;

    Asset* asset = GetAssetByPath(fullPath);

    if (!asset && fs->FileExists(fullPath))
    {
        Scan();
        return;
    }

    if (asset)
    {
        if(!fs->Exists(fullPath))
        {
            DeleteAsset(asset);
        }
        else
        {
            if (asset->GetFileTimestamp() != fs->GetLastModifiedTime(asset->GetPath()))
            {
                asset->SetDirty(true);
                Scan();
            }
        }
    }
}