string CanvasNode::getEffectiveMediaDir() { string sMediaDir = getMediaDir(); if (!isAbsPath(sMediaDir)) { sMediaDir = Player::get()->getCurDirName()+sMediaDir; } if (sMediaDir[sMediaDir.length()-1] != '/') { sMediaDir += '/'; } return sMediaDir; }
vcCfgStyle vc_getVserverCfgStyle(char const *id) { vcCfgStyle res = vcCFG_NONE; size_t l1 = strlen(id); char buf[l1 + MAX(sizeof(CONFDIR "/"),sizeof(DEFAULT_VSERVERDIR "/")) + MAX(sizeof("/legacy"), sizeof(".conf")) - 1]; char * marker = 0; bool is_path; strcpy(buf, id); marker = buf+l1; strcpy(marker, "/vdir"); is_path = isAbsPath(buf) || isRelPath(buf); if (is_path && (ISDIR || ISLINK)) res = vcCFG_RECENT_FULL; else if (!is_path) { strcpy(buf, CONFDIR "/"); strcpy(buf+sizeof(CONFDIR "/") - 1, id); marker = buf+sizeof(CONFDIR "/")+l1 - 1; strcpy(marker, "/vdir"); if (ISDIR) res = vcCFG_RECENT_SHORT; else { strcpy(buf, DEFAULT_VSERVERDIR "/"); strcpy(buf+sizeof(DEFAULT_VSERVERDIR)+1 - 1, id); if (ISDIR) res = vcCFG_LEGACY; } if (res==vcCFG_LEGACY) { strcpy(buf, CONFDIR "/"); strcpy(buf+sizeof(CONFDIR "/") - 1, id); strcpy(buf+sizeof(CONFDIR "/")+l1 - 1, ".conf"); if (!ISFILE) res = vcCFG_NONE; } } if (res==vcCFG_RECENT_FULL || res==vcCFG_RECENT_SHORT) { assert(marker!=0); strcpy(marker, "/legacy"); if (access(buf, F_OK)==0) res=vcCFG_LEGACY; } return res; }
string DivNode::getEffectiveMediaDir() { // TODO: There is no test for this function. string sMediaDir = m_sMediaDir; if (!isAbsPath(sMediaDir)) { if (getParent()) { sMediaDir = getParent()->getEffectiveMediaDir()+m_sMediaDir; } else { sMediaDir = Player::get()->getRootMediaDir()+m_sMediaDir; } } if (sMediaDir[sMediaDir.length()-1] != '/') { sMediaDir += '/'; } return sMediaDir; }