Exemple #1
0
void Parser::SaveDepInfo(const CC_STRING& s)
{
	if(writers[VCH_DEP] && !s.isnull()) {
		ssize_t ret;
		ret = writers[VCH_DEP]->Write(s.c_str(), s.size());
		if(ret < 0)
			exit(-EPIPE);
	}
}
Exemple #2
0
int fsl_mkdir(const CC_STRING& dirname)
{
    CC_STRING newdir;
	char *p, *dir;
	struct stat stb;
	int retval = 0;

	if( dirname[0] != '/' ) {
        newdir = fsl_realpath(dirname);
		if( newdir.isnull() ) {
			retval = -EINVAL;
			goto fail;
		}
	} else
		newdir = dirname.c_str();

	dir = (char*)newdir.c_str();
	if(newdir[0] == '/')
		p = (char*)newdir.c_str() + 1;
	else
		p = (char*)newdir.c_str();
	while(1) {
		char c = *p;
		if(c == 0 || c == '/') {
			const char saved_char = *p;
			*p = '\0';
			if(stat(dir, &stb) != 0) {
				if ( mkdir(dir, 0775) != 0 ) {
					retval = -errno;
					goto fail;
				}
			} else if( ! S_ISDIR(stb.st_mode) ) {
				retval = -EEXIST;
				goto fail;
			}
			if(c == '\0')
				break;
			*p = saved_char;
		}
		p ++;
	}

fail:
	return retval;
}
Exemple #3
0
static bool GetRealPath(const CC_STRING& name, CC_STRING& opath)
{
/*  Use my own function rather than realpath since realpath will expand symblic links */
	opath = fol_realpath(name);
	return ! opath.isnull() ;
}