本文整理汇总了C++中splitPath函数的典型用法代码示例。如果您正苦于以下问题:C++ splitPath函数的具体用法?C++ splitPath怎么用?C++ splitPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了splitPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: splitPath
bool ResourceManagerImpl::searchUpwards( std::string const &base, std::string const &subpath, std::string &dest )
{
bool exists = false;
// TODO debug g_message("............");
std::vector<std::string> parts = splitPath(subpath);
std::vector<std::string> baseParts = splitPath(base);
while ( !exists && !baseParts.empty() ) {
std::vector<std::string> current;
current.insert(current.begin(), parts.begin(), parts.end());
// TODO debug g_message(" ---{%s}", Glib::build_filename( baseParts ).c_str());
while ( !exists && !current.empty() ) {
std::vector<std::string> combined;
combined.insert( combined.end(), baseParts.begin(), baseParts.end() );
combined.insert( combined.end(), current.begin(), current.end() );
std::string filepath = Glib::build_filename( combined );
exists = Glib::file_test(filepath, Glib::FILE_TEST_EXISTS);
// TODO debug g_message(" ...[%s] %s", filepath.c_str(), (exists ? "XXX" : ""));
if ( exists ) {
dest = filepath;
}
current.erase( current.begin() );
}
baseParts.pop_back();
}
return exists;
}
开发者ID:panjh,项目名称:inkscape,代码行数:29,代码来源:resource-manager.cpp
示例2: bigWigCorrelateList
void bigWigCorrelateList(char *listFile)
/* Correlate all files in list to each other */
{
char **fileNames = NULL;
int fileCount = 0;
char *buf = NULL;
readAllWords(listFile, &fileNames, &fileCount, &buf);
int i;
for (i=0; i<fileCount; ++i)
{
char *aPath = fileNames[i];
char aName[FILENAME_LEN];
if (rootNames)
splitPath(aPath, NULL, aName, NULL);
else
safef(aName, sizeof(aName), "%s", aPath);
int j;
for (j=i+1; j<fileCount; ++j)
{
char *bPath = fileNames[j];
char bName[FILENAME_LEN];
if (rootNames)
splitPath(bPath, NULL, bName, NULL);
else
safef(bName, sizeof(bName), "%s", bPath);
struct correlate *c = bigWigCorrelate(aPath, bPath);
printf("%s\t%s\t%g\n", aName, bName, correlateResult(c));
correlateFree(&c);
}
}
}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:31,代码来源:bigWigCorrelate.c
示例3: convertPathToRelative
static std::string convertPathToRelative( std::string const &path, std::string const &docbase )
{
std::string result = path;
if ( !path.empty() && Glib::path_is_absolute(path) ) {
// Whack the parts into pieces
std::vector<std::string> parts = splitPath(path);
std::vector<std::string> baseParts = splitPath(docbase);
// TODO debug g_message("+++++++++++++++++++++++++");
for ( std::vector<std::string>::iterator it = parts.begin(); it != parts.end(); ++it ) {
// TODO debug g_message(" [%s]", it->c_str());
}
// TODO debug g_message(" - - - - - - - - - - - - - - - ");
for ( std::vector<std::string>::iterator it = baseParts.begin(); it != baseParts.end(); ++it ) {
// TODO debug g_message(" [%s]", it->c_str());
}
// TODO debug g_message("+++++++++++++++++++++++++");
if ( !parts.empty() && !baseParts.empty() && (parts[0] == baseParts[0]) ) {
// Both paths have the same root. We can proceed.
while ( !parts.empty() && !baseParts.empty() && (parts[0] == baseParts[0]) ) {
parts.erase( parts.begin() );
baseParts.erase( baseParts.begin() );
}
// TODO debug g_message("+++++++++++++++++++++++++");
for ( std::vector<std::string>::iterator it = parts.begin(); it != parts.end(); ++it ) {
// TODO debug g_message(" [%s]", it->c_str());
}
// TODO debug g_message(" - - - - - - - - - - - - - - - ");
for ( std::vector<std::string>::iterator it = baseParts.begin(); it != baseParts.end(); ++it ) {
// TODO debug g_message(" [%s]", it->c_str());
}
// TODO debug g_message("+++++++++++++++++++++++++");
if ( !parts.empty() ) {
result.clear();
for ( size_t i = 0; i < baseParts.size(); ++i ) {
parts.insert(parts.begin(), "..");
}
result = Glib::build_filename( parts );
// TODO debug g_message("----> [%s]", result.c_str());
}
}
}
return result;
}
开发者ID:panjh,项目名称:inkscape,代码行数:51,代码来源:resource-manager.cpp
示例4: loadPslTable
void loadPslTable(char *database, struct sqlConnection *conn, char *pslFile)
/* load one psl table */
{
char table[128];
char *tabFile;
boolean indirectLoad = FALSE;
verbose(1, "Processing %s\n", pslFile);
/* determine table name to use */
if (clTableName != NULL)
safef(table, sizeof(table), "%s", clTableName);
else
{
if (endsWith(pslFile, ".gz"))
{
char *stripGz;
stripGz = cloneString(pslFile);
chopSuffix(stripGz);
splitPath(stripGz, NULL, table, NULL);
freeMem(stripGz);
}
else
splitPath(pslFile, NULL, table, NULL);
}
setupTable(database, conn, table);
/* if a bin column is being added or if the input file is
* compressed, we must copy to an intermediate tab file */
indirectLoad = ((pslCreateOpts & PSL_WITH_BIN) != 0) || endsWith(pslFile, ".gz") || !noSort;
if (indirectLoad)
{
tabFile = "psl.tab";
if (pslCreateOpts & PSL_XA_FORMAT)
copyPslXaToTab(pslFile, tabFile);
else
copyPslToTab(pslFile, tabFile);
}
else
tabFile = pslFile;
sqlLoadTabFile(conn, tabFile, table, pslLoadOpts);
if (!noHistory)
hgHistoryComment(conn, "Add psl alignments to %s table", table);
if (indirectLoad && !keep)
unlink(tabFile);
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:51,代码来源:hgLoadPsl.c
示例5: makeC
void makeC(struct dtdElement *elList, char *fileName, char *incName)
/* Produce C code file. */
{
FILE *f = mustOpen(fileName, "w");
struct dtdElement *el;
char incFile[128], incExt[64];
splitPath(incName, NULL, incFile, incExt);
fprintf(f, "/* %s.c %s */\n", prefix, fileComment);
fprintf(f, "\n");
fprintf(f, "#include \"common.h\"\n");
fprintf(f, "#include \"xap.h\"\n");
fprintf(f, "#include \"%s%s\"\n", incFile, incExt);
fprintf(f, "\n");
fprintf(f, "\n");
for (el = elList; el != NULL; el = el->next)
{
freeFunctionPrototype(el, f, "");
freeFunctionBody(el, f);
freeListFunctionPrototype(el, f, "");
freeListFunctionBody(el, f);
saveFunctionPrototype(el, f, "");
saveFunctionBody(el, f);
loadFunctionPrototype(el, f, "");
loadFunctionBody(el, f);
loadNextFunctionPrototype(el, f, "");
loadNextFunctionBody(el, f);
}
makeStartHandler(elList, f);
makeEndHandler(elList, f);
if (makeMain)
makeTestDriver(elList, f);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:35,代码来源:autoXml.c
示例6: getFileName
static std::string getFileName(const std::string &path)
{
std::string directory;
std::string file;
splitPath(path, directory, file);
return file;
}
开发者ID:mgottschlag,项目名称:CoreRender,代码行数:7,代码来源:FileSystem.hpp
示例7: getDirectory
static std::string getDirectory(const std::string &path)
{
std::string directory;
std::string file;
splitPath(path, directory, file);
return directory;
}
开发者ID:mgottschlag,项目名称:CoreRender,代码行数:7,代码来源:FileSystem.hpp
示例8: splitByNamePrefix
void splitByNamePrefix(char *inName, char *outRoot, int preFixCount)
/* Split into chunks using prefix of sequence names. */
{
struct dnaSeq seq;
struct lineFile *lf = lineFileOpen(inName, TRUE);
FILE *f = NULL;
char outDir[256], outFile[128], ext[64], outPath[512], preFix[512];
ZeroVar(&seq);
splitPath(outRoot, outDir, outFile, ext);
assert(preFixCount < sizeof(preFix));
while (faMixedSpeedReadNext(lf, &seq.dna, &seq.size, &seq.name))
{
carefulClose(&f);
strncpy(preFix, seq.name, preFixCount);
preFix[preFixCount] = '\0';
sprintf(outPath, "%s%s.fa", outDir, preFix);
verbose(2, "writing %s\n", outPath);
f = mustOpen(outPath, "a");
faWriteNext(f, seq.name, seq.dna, seq.size);
}
carefulClose(&f);
lineFileClose(&lf);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:25,代码来源:faSplit.c
示例9: Q_ASSERT
void DrawingAnchor::loadXmlObjectPicture(QXmlStreamReader &reader)
{
Q_ASSERT(reader.name() == QLatin1String("pic"));
while (!reader.atEnd()) {
reader.readNextStartElement();
if (reader.tokenType() == QXmlStreamReader::StartElement) {
if (reader.name() == QLatin1String("blip")) {
QString rId = reader.attributes().value(QLatin1String("r:embed")).toString();
QString name = m_drawing->relationships()->getRelationshipById(rId).target;
QString path = QDir::cleanPath(splitPath(m_drawing->filePath())[0] + QLatin1String("/") + name);
bool exist = false;
QList<QSharedPointer<MediaFile> > mfs = m_drawing->workbook->mediaFiles();
for (int i=0; i<mfs.size(); ++i) {
if (mfs[i]->fileName() == path) {
//already exist
exist = true;
m_pictureFile = mfs[i];
}
}
if (!exist) {
m_pictureFile = QSharedPointer<MediaFile> (new MediaFile(path));
m_drawing->workbook->addMediaFile(m_pictureFile, true);
}
}
} else if (reader.tokenType() == QXmlStreamReader::EndElement
&& reader.name() == QLatin1String("pic")) {
break;
}
}
return;
}
开发者ID:olegyurchenko,项目名称:QtXlsxWriter,代码行数:34,代码来源:xlsxdrawinganchor.cpp
示例10: splitPath
//---------------------------------------------------------------------
// remove a file of the dir content - if present
fxp_name * Server::removeFile(bstring const & remotePath) {
bstring path, file;
file = splitPath(path, remotePath);
DirCache::iterator i = dirCache.find(path);
if (i == dirCache.end())
return 0;
my_fxp_names * dir = i->second;
int count = dir->nnames;
for (int i = 0; i < count; ++i) {
fxp_name * fn = dir->names[i];
if (file == fn->filename) {
// not last -> replace current with last
if (i + 1 < count) {
dir->names[i] = dir->names[count - 1];
}
// and one less now
--dir->nnames;
return fn; // done
}
}
return 0;
}
开发者ID:BackupTheBerlios,项目名称:sftp4tc-svn,代码行数:28,代码来源:server.cpp
示例11: writeRelevantSplits
void writeRelevantSplits(char *ctgDir, struct hash *splitCloneHash)
/* Write out splits if there are any. */
{
char fileName[512], dir[256], name[128], ext[64];
char *cnBuf, **cloneNames, *clonePath;
int i, cloneCount;
FILE *f;
struct clone *clone;
struct frag *frag;
sprintf(fileName, "%s/geno.lst", ctgDir);
readAllWords(fileName, &cloneNames, &cloneCount, &cnBuf);
sprintf(fileName, "%s/splitFin", ctgDir);
f = mustOpen(fileName, "w");
for (i=0; i<cloneCount; ++i)
{
clonePath = cloneNames[i];
splitPath(clonePath, dir, name, ext);
if ((clone = hashFindVal(splitCloneHash, name)) != NULL)
{
printf(" Split %s in %s\n", name, ctgDir);
for (frag = clone->fragList; frag != NULL; frag = frag->next)
{
fprintf(f, "%s\t%s\t%d\t%d\n",
frag->name, clone->name, frag->start, frag->end);
}
}
}
fclose(f);
freeMem(cloneNames);
freeMem(cnBuf);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:32,代码来源:ooSplitFins.c
示例12: writeRelevantChains
void writeRelevantChains(char *ctgDir, struct hash *cloneHash)
/* Read in geno.lst and write chains on relevant clones to
* fragChains. */
{
char inName[512];
char outName[512];
char *wordBuf, **faNames;
int faCount;
int i;
char dir[256], cloneName[128], ext[64];
FILE *f;
struct clone *clone;
sprintf(inName, "%s/geno.lst", ctgDir);
sprintf(outName, "%s/fragChains", ctgDir);
readAllWords(inName, &faNames, &faCount, &wordBuf);
f = mustOpen(outName, "w");
for (i=0; i<faCount; ++i)
{
splitPath(faNames[i], dir, cloneName, ext);
if (!startsWith("NT_", cloneName))
{
clone = hashMustFindVal(cloneHash, cloneName);
writeChains(clone, f);
}
}
freeMem(wordBuf);
fclose(f);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:29,代码来源:ooChains.c
示例13: readAllWords
struct slName *getFileList(char *listFile, char *bulkDir)
/* Get list of files to work on from listFile. */
{
char **faFiles;
char *faBuf;
int faCount;
int i;
char path[512], dir[256], name[128], extension[64];
struct slName *list = NULL, *el;
readAllWords(listFile, &faFiles, &faCount, &faBuf);
for (i = 0; i<faCount; ++i)
{
splitPath(faFiles[i], dir, name, extension);
sprintf(path, "%s/%s.%s",
bulkDir,
name, "psl");
if (fileExists(path))
{
el = newSlName(path);
slAddHead(&list, el);
}
}
slReverse(&list);
return list;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:26,代码来源:pslGlue.c
示例14: splitPath
void ModelLoader::loadModel(std::string path, ModelData* modelData)
{
std::string basename, directory;
splitPath(path, &basename, &directory);
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
std::string err = tinyobj::LoadObj(shapes, materials, path.c_str(), directory.c_str());
modelData->vertices.clear();
modelData->indices.clear();
modelData->material.reset();
modelData->diffuseTex.reset();
modelData->alphaTex.reset();
if (materials.size() > 0)
{
modelData->material.reset(createMaterialFromMtl(*materials.begin()));
if (!materials.begin()->diffuse_texname.empty())
modelData->diffuseTex.reset(loadImage(directory, materials.begin()->diffuse_texname));
else modelData->diffuseTex.reset();
if (!materials.begin()->alpha_texname.empty())
modelData->alphaTex.reset(loadImage(directory, materials.begin()->alpha_texname));
else modelData->alphaTex.reset();
}
if (!err.empty())
throw Exception(err);
loadShapes(shapes, &modelData->vertices, &modelData->indices);
}
开发者ID:trolleyyy,项目名称:GK3D,代码行数:29,代码来源:ModelLoader.cpp
示例15: recurseThroughIncludes
static void recurseThroughIncludes(char *fileName, struct lm *lm,
struct hash *circularHash, struct raLevel *level, struct raFile **pFileList)
/* Recurse through include files. */
{
struct raFile *raFile = raFileRead(fileName, level, lm);
slAddHead(pFileList, raFile);
struct raRecord *r;
for (r = raFile->recordList; r != NULL; r = r->next)
{
struct raTag *tag = r->tagList;
if (sameString(tag->name, "include"))
{
for (; tag != NULL; tag = tag->next)
{
if (!sameString(tag->name, "include"))
recordAbort(r, "Non-include tag %s in an include stanza", tag->name);
char *relPath = tag->val;
char dir[PATH_LEN];
splitPath(fileName, dir, NULL, NULL);
char includeName[PATH_LEN];
safef(includeName, sizeof(includeName), "%s%s", dir, relPath);
if (hashLookup(circularHash, includeName))
recordAbort(r, "Including file %s in an infinite loop", includeName);
recurseThroughIncludes(includeName, lm, circularHash, level, pFileList);
}
}
}
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:28,代码来源:tdbRewriteReduceReplaces.c
示例16: getDirname
string getDirname(const string &path)
{
string dir;
string file;
splitPath(path, dir, file);
return dir;
}
开发者ID:mikmakmuk,项目名称:syncevolution_n9,代码行数:7,代码来源:util.cpp
示例17: ccdsGetTblFileNames
void ccdsGetTblFileNames(char *tblFile, char *table, char *tabFile)
/* Get table and tab file name from a single input name. If specified names
* looks like a file name, use it as-is, otherwise generate a file name.
* Output buffers should be PATH_LEN bytes long. Either output argument maybe
* be NULL. */
{
if ((strchr(tblFile, '/') != NULL) || (strchr(tblFile, '.') != NULL))
{
if (tabFile != NULL)
safef(tabFile, PATH_LEN, "%s", tblFile);
if (table != NULL)
splitPath(tblFile, NULL, table, NULL);
}
else
{
if (tabFile != NULL)
{
char *tmpDir = getenv("TMPDIR");
if (tmpDir != NULL)
safef(tabFile, PATH_LEN, "%s/%s.tab", tmpDir, tblFile);
else
safef(tabFile, PATH_LEN, "%s.tab", tblFile);
}
if (table != NULL)
safef(table, PATH_LEN, "%s", tblFile);
}
}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:27,代码来源:ccdsCommon.c
示例18: gfiGetSeqName
void gfiGetSeqName(char *spec, char *name, char *file)
/* Extract sequence name and optionally file name from spec,
* which includes nib and 2bit files. (The file may be NULL
* if you don't care.) */
{
if (nibIsFile(spec))
{
splitPath(spec, NULL, name, NULL);
if (file != NULL)
strcpy(file, spec);
}
else
{
char *s = strchr(spec, ':');
if (s == NULL)
errAbort("Expecting colon in %s", spec);
strcpy(name, s+1);
if (file != NULL)
{
int fileNameSize = s - spec;
memcpy(file, spec, fileNameSize);
file[fileNameSize] = 0;
}
}
}
开发者ID:JinfengChen,项目名称:pblat,代码行数:25,代码来源:gfInternal.c
示例19: mkOutPath
void mkOutPath(char *outPath, char* outRoot, int digits, int fileCount)
/* generate output file name */
{
char dir[PATH_LEN], fname[PATH_LEN];
splitPath(outRoot, dir, fname, NULL);
strcpy(outPath, dir);
if (outDirDepth > 0)
{
/* add directory levels, using training digits for names */
char fcntStr[64], dirBuf[3];
int i, iDir;
safef(fcntStr, sizeof(fcntStr), "%0*d", outDirDepth, fileCount);
iDir = strlen(fcntStr)-outDirDepth;
strcpy(dirBuf, "X/");
for (i = 0; i < outDirDepth; i++, iDir++)
{
dirBuf[0] = fcntStr[iDir];
strcat(outPath, dirBuf);
makeDir(outPath);
}
}
if (digits)
sprintf(outPath+strlen(outPath), "%s%0*d.fa", fname, digits, fileCount);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:26,代码来源:faSplit.c
示例20: getBasename
string getBasename(const string &path)
{
string dir;
string file;
splitPath(path, dir, file);
return file;
}
开发者ID:mikmakmuk,项目名称:syncevolution_n9,代码行数:7,代码来源:util.cpp
注:本文中的splitPath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论