void MusicUtils::UCore::checkTheDirectoryExist() { dirIsExist(LRC_DIR_FULL); dirIsExist(MUSIC_DIR_FULL); dirIsExist(MOVIE_DIR_FULL); dirIsExist(CACHE_DIR_FULL); dirIsExist(THEME_DIR_FULL); dirIsExist(ART_DIR_FULL); dirIsExist(PLUGINS_DIR_FULL); dirIsExist(BACKGROUND_DIR_FULL); dirIsExist(LANGUAGE_DIR_FULL); }
void MusicUtils::checkTheDirectoryExist() { dirIsExist(MusicObject::getAppDir() + LRC_DOWNLOAD); dirIsExist(MusicObject::getAppDir() + MUSIC_DOWNLOAD); dirIsExist(MusicObject::getAppDir() + MOVIE_DOWNLOAD); dirIsExist(MusicObject::getAppDir() + DATA_CACHED); dirIsExist(MusicObject::getAppDir() + THEME_DOWNLOAD); dirIsExist(MusicObject::getAppDir() + ART_DOWNLOAD); dirIsExist(MusicObject::getAppDir() + TRANS_PLUGINS); dirIsExist(MusicObject::getAppDir() + ART_BG); dirIsExist(MusicObject::getAppDir() + TR_LANGUAGE); }
/************************************************************************************************* * function : write log to file * para : {char *format} content format; * * return : {int } 0: ok; -1:error. * * history : {2013.8.5 wujun} frist create; **************************************************************************************************/ int writeLog(char *format,...) { if( format == NULL) { #ifdef DEBUG printf("Fun(writeLog): parameter is Null.\n"); #endif return -1; } struct tm *st; time_t t; t = time(NULL); st = localtime(&t);//get current datetime int day = st->tm_mday + 1; int month = st->tm_mon + 1; int year = st->tm_year + 1990; char logFile[100] ; memset(logFile, 0, 100); sprintf(logFile, "log/%04d%02d%02d.log", year, month, day); dirIsExist("log/"); FILE *dwLogFp; if( (dwLogFp=fopen( logFile ,"at") ) == NULL ) { dwLogFp = fopen( logFile ,"wt"); if( dwLogFp == NULL ) { #ifdef DEBUG printf("Fun(writeLog):create file %s error.\n ",logFile); #endif return -1; } } va_list arg_ptr; va_start(arg_ptr, format); vfprintf(dwLogFp, format, arg_ptr); va_end(arg_ptr); fclose(dwLogFp); }
int plog(char *format,...) { if( format == NULL) { printf("Fun(plog): parameter is Null.\n"); return -1; } char startTime[100] ; memset(startTime, 0, 100); struct tm *st; time_t t; t = time(NULL); st = localtime(&t);//get current datetime int day = st->tm_mday; int month = st->tm_mon + 1; int year = st->tm_year + 1900; sprintf(startTime,"%d-%d-%d %d:%d:%d", year, month, day, st->tm_hour, st->tm_min, st->tm_sec); char logFile[100] ; memset(logFile, 0, 100); sprintf(logFile, "log/ftp/%04d%02d%02d_%03d.log", year, month, day, (int)(giLogLine/2000) ); dirIsExist("log/ftp/"); FILE *dwLogFp; if( (dwLogFp=fopen( logFile ,"a+") ) == NULL ) { printf("%s\n","Fun(plog):create file error.\n "); return -1; } va_list arg_ptr; va_start(arg_ptr, format); fprintf(dwLogFp,"%s\t",startTime); vfprintf(dwLogFp, format, arg_ptr); va_end(arg_ptr); fclose(dwLogFp); ftp_delay(); }