Exemplo n.º 1
0
static bool mapPath(ZonePathMap const &map, OovString const &origName,
        OovString &newName)
    {
    bool replaced = false;
    size_t starti = 0;
    newName = origName;
    do
        {
        size_t firstFoundi = OovString::npos;
        ZonePathReplaceItem const *repItem = nullptr;
        for(auto const &mapItem : map)
            {
            size_t foundi = newName.find(mapItem.mSearchPath, starti);
            if(foundi < firstFoundi)
                {
                repItem = &mapItem;
                firstFoundi = foundi;
                }
            }
        if(firstFoundi != OovString::npos)
            {
            newName.replace(firstFoundi, repItem->mSearchPath.length(),
                    repItem->mReplacePath);
            starti = firstFoundi + repItem->mReplacePath.length();
            replaced = true;
            }
        else
            starti = OovString::npos;
        } while(starti != OovString::npos);
    return replaced;
    }
Exemplo n.º 2
0
static bool isDevelopment()
    {
    static enum eDevel { Uninit, Devel, Deploy } devel;
    if(devel == Uninit)
        {
        OovString path = Project::getBinDirectory();
        size_t pos = path.find("bin");
        if(pos != std::string::npos)
            {
            path.replace(pos, 3, "lib");
            }
        OovStatus status(true, SC_File);
        if(FileIsDirOnDisk(path, status))
            {
            devel = Deploy;
            }
        else
            {
            devel = Devel;
            }
        if(status.needReport())
            {
            status.reported();
            }
        }
    return(devel == Devel);
    }
Exemplo n.º 3
0
/// Use the filename to make an identifier.
static std::string makeOrigCovFn(OovStringRef const fn)
    {
    OovString covFn = fn;
    if(covFn.find("COV_") != std::string::npos)
        {
        covFn.erase(0, 4);
        }
    covFn.replaceStrs("_", "/");
    size_t pos = covFn.rfind('/');
    if(pos != std::string::npos)
        {
        covFn.replace(pos, 1, ".");
        }
    return covFn;
    }
Exemplo n.º 4
0
OovString const Project::getLibDirectory()
    {
    OovString path = getBinDirectory();
#ifdef __linux__
    // During development, the libs/.so are in the bin dir.
    if(!isDevelopment())
        {
        size_t pos = path.find("bin");
        if(pos != std::string::npos)
            {
            path.replace(pos, 3, "lib");
            }
        }
#endif
    return path;
    }