• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MakeDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MakeDir函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeDir函数的具体用法?C++ MakeDir怎么用?C++ MakeDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MakeDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: initDirectorySets

/* 系统辅助函数-Init [Directory Sets] this System needs */
void initDirectorySets(void){
	char dirName[MAX_PATHNAME_LEN];
	char DataDirPath[MAX_PATHNAME_LEN];
	char LogDirPath[MAX_PATHNAME_LEN];
	GetProjectDir(dirName);
	sprintf(DataDirPath, "%s\\DataStorage", dirName);
	sprintf(LogDirPath, "%s\\Logs", dirName);
	int oldValue;
	oldValue = SetBreakOnLibraryErrors(0);
	int isDataDirExisted = MakeDir(DataDirPath);
	int isLogDirExisted = MakeDir(LogDirPath);
	SetBreakOnLibraryErrors (oldValue);
	if(isDataDirExisted == 0)
		addLog("Successfully create the Directory:\n\"DataStorage\" and \"Logs\"", 0, panelHdl);
	else if( isDataDirExisted == -9)
		addLog("\"DataStorage\" and \"Logs\" \nDirectory has already existed!", 0, panelHdl);
	
}
开发者ID:HelloLyfing,项目名称:Signal_Monitor_System_Based_On_LabWindows-CVI,代码行数:19,代码来源:MainCode.c


示例2: CreatePath

bool CreatePath(const wchar *Path,bool SkipLastName)
{
  if (Path==NULL || *Path==0)
    return(false);

#if defined(_WIN_ALL) || defined(_EMX)
  uint DirAttr=0;
#else
  uint DirAttr=0777;
#endif
  
  bool Success=true;

  for (const wchar *s=Path;*s!=0;s++)
  {
    if (s-Path>=NM)
      break;

    if (*s==CPATHDIVIDER)
    {
      wchar DirName[NM];
      wcsncpy(DirName,Path,s-Path);
      DirName[s-Path]=0;

      if (MakeDir(NULL,DirName,true,DirAttr)==MKDIR_SUCCESS)
      {
#ifndef GUI
        char DirNameA[NM];
        WideToChar(DirName,DirNameA,ASIZE(DirNameA));
        DirNameA[ASIZE(DirNameA)-1]=0;
        mprintf(St(MCreatDir),DirNameA);
        mprintf(" %s",St(MOk));
#endif
      }
      else
        Success=false;
    }
  }
  if (!SkipLastName)
    if (!IsPathDiv(*PointToLastChar(Path)))
      if (MakeDir(NULL,Path,true,DirAttr)!=MKDIR_SUCCESS)
        Success=false;
  return(Success);
}
开发者ID:ajnelson,项目名称:bulk_extractor,代码行数:44,代码来源:filefn.cpp


示例3: MakeDir

DEFINE_THIS_FILE

/*----------------------------------------------------------------------------------------------
	This is called recursively to create all the directories in the given path. If any part of
	the path already exists, then that is not a problem.

	@param pszPath Path whose directories are to be created.
	@return False if path did not exist and could not be created, otherwise True.
----------------------------------------------------------------------------------------------*/
bool MakeDir(const achar * pszPath)
{
#if WIN32
	StrAppBufPath strbp(pszPath);

	// Look for last backslash:
	StrAppBuf strbSlash("\\");
#else
	StrAnsiBufPath strbp(pszPath);

	// Look for last slash:
	StrAnsiBuf strbSlash("/");
#endif
	int ichStart = strbp.ReverseFindCh(strbSlash[0]);
	if (ichStart > 0)
	{
		// Make path comprising all except last component:
		StrAppBufPath strbpSmaller;
		strbpSmaller.Assign(strbp.Left(ichStart).Chars());

		// Check for recursion base case - no more backslashes:
		ichStart = strbpSmaller.ReverseFindCh(strbSlash[0]);
		if (ichStart > 0)
		{
			if (!MakeDir(strbpSmaller))
				return false;
		}
	}
	// If this next call fails, it may only be because the path already exists, so we will check
	// our overall success afterwards:
#if WIN32
	_tmkdir(strbp.Chars());
	DWORD nFlags = GetFileAttributes(strbp.Chars());
	if (nFlags == INVALID_FILE_ATTRIBUTES || !(nFlags & FILE_ATTRIBUTE_DIRECTORY))
		return false;
#else
	mkdir(strbp.Chars(), 0777);

	struct stat filestats;
	bool statfailed = stat(strbp.Chars(), &filestats);
	if (!statfailed && !S_ISDIR(filestats.st_mode))
		return false;
#endif
	return true;
}
开发者ID:agran147,项目名称:FieldWorks,代码行数:54,代码来源:MakeDir.cpp


示例4: GetTremulousPk3s

bool GetTremulousPk3s(const char* destdir, const char* basegame)
{
    std::string baseuri = "https://github.com/wtfbbqhax/tremulous-data/raw/master/";
    std::vector<std::string> files = { 
        "data-gpp1.pk3",
        "data-1.1.0.pk3",
        "map-arachnid2-1.1.0.pk3",
        "map-atcs-1.1.0.pk3",
        "map-karith-1.1.0.pk3",
        "map-nexus6-1.1.0.pk3",
        "map-niveus-1.1.0.pk3",
        "map-transit-1.1.0.pk3",
        "map-tremor-1.1.0.pk3",
        "map-uncreation-1.1.0.pk3"
    };

    RestClient::init();

    MakeDir(destdir, basegame);

    if (!PromptDownloadPk3s(basegame, files))
        return false;

    for (auto f : files )
    {
        std::string destpath(destdir);
        destpath += "/";
        destpath += basegame;
        destpath += "/";
        destpath += f;

        if ( is_good(destpath) )
        {
            return false;
        }

        std::cout << "Downloading " << baseuri << f << std::endl;
        std::ofstream dl(destpath);
        //dl.open(destpath);
        if ( dl.fail() )
        {
            std::cerr << "Error " << strerror(errno) << "\n";
            continue;
        }

        RestClient::Response resp = RestClient::get(baseuri + f);

        dl << resp.body;
        dl.close();
    }

    return true;
}
开发者ID:GrangerHub,项目名称:tremulous,代码行数:53,代码来源:cl_rest.cpp


示例5: InitSystem

static void InitSystem(void) {
  ProcessList = NULL;
  InitDirectory();
  SetUpDirectory(Directory, NULL, NULL, NULL, P_NONE);
  setenv("MON_DIRECTORY_PATH", Directory, 1);
  if (ThisEnv == NULL) {
    Error("DI file parse error.");
  }
  if (!MakeDir(TempDir, 0700)) {
    Error("cannot make TempDirRoot:%s", TempDir);
  }
  setenv("MCP_TEMPDIR_ROOT", TempDir, 1);
}
开发者ID:montsuqi,项目名称:panda,代码行数:13,代码来源:monitor.c


示例6: CreateDirs

/* create all the bozo dirs */
static int
CreateDirs(const char *coredir)
{
    if ((!strncmp
	 (AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
	  strlen(AFSDIR_USR_DIRPATH)))
	||
	(!strncmp
	 (AFSDIR_USR_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
	  strlen(AFSDIR_USR_DIRPATH)))) {
	MakeDir(AFSDIR_USR_DIRPATH);
    }
    if (!strncmp
	(AFSDIR_SERVER_AFS_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
	 strlen(AFSDIR_SERVER_AFS_DIRPATH))) {
	MakeDir(AFSDIR_SERVER_AFS_DIRPATH);
    }
    MakeDir(AFSDIR_SERVER_BIN_DIRPATH);
    MakeDir(AFSDIR_SERVER_ETC_DIRPATH);
    MakeDir(AFSDIR_SERVER_LOCAL_DIRPATH);
    MakeDir(AFSDIR_SERVER_DB_DIRPATH);
    MakeDir(AFSDIR_SERVER_LOGS_DIRPATH);
#ifndef AFS_NT40_ENV
    if (!strncmp
	(AFSDIR_CLIENT_VICE_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
	 strlen(AFSDIR_CLIENT_VICE_DIRPATH))) {
	MakeDir(AFSDIR_CLIENT_VICE_DIRPATH);
    }
    MakeDir(AFSDIR_CLIENT_ETC_DIRPATH);

    symlink(AFSDIR_SERVER_THISCELL_FILEPATH, AFSDIR_CLIENT_THISCELL_FILEPATH);
    symlink(AFSDIR_SERVER_CELLSERVDB_FILEPATH,
	    AFSDIR_CLIENT_CELLSERVDB_FILEPATH);
#endif /* AFS_NT40_ENV */
    if (coredir)
	MakeDir(coredir);
    return 0;
}
开发者ID:hwr,项目名称:openafs,代码行数:39,代码来源:bosserver.c


示例7: MakeFileDir

int
MakeFileDir( const char* path, int permissions )
{
    // First get just the directories without the file
    int retValue, pathLength = strlen( path );
    char* dirs = (char*) malloc( pathLength+1 );
    memcpy( dirs, path, pathLength+1 );
    StripLastPathComponent( dirs, pathLength );

    // Now we make sure the directories exist
    retValue = MakeDir( dirs, permissions );

    free( dirs );
    return retValue;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:15,代码来源:main.c


示例8: CreatePath

void CreatePath(const char *Path,const wchar *PathW,bool SkipLastName)
{
#ifdef _WIN_32
  uint DirAttr=0;
#else
  uint DirAttr=0777;
#endif
  int PosW=0;
  for (const char *s=Path;*s!=0 && PosW<NM;s=charnext(s),PosW++)
  {
    bool Wide=PathW!=NULL && *PathW!=0;
    if (Wide && PathW[PosW]==CPATHDIVIDER || !Wide && *s==CPATHDIVIDER)
    {
      wchar *DirPtrW=NULL;
      if (Wide)
      {
        wchar DirNameW[NM];
        strncpyw(DirNameW,PathW,PosW);
        DirNameW[PosW]=0;
        DirPtrW=DirNameW;
      }
      char DirName[NM];
      strncpy(DirName,Path,s-Path);
      DirName[s-Path]=0;
      if (MakeDir(DirName,DirPtrW,DirAttr)==MKDIR_SUCCESS)
      {
#ifndef GUI
        mprintf(St(MCreatDir),DirName);
        mprintf(" %s",St(MOk));
#endif
      }
    }
  }
  if (!SkipLastName)
    MakeDir(Path,PathW,DirAttr);
}
开发者ID:zachberger,项目名称:UnRarX,代码行数:36,代码来源:filefn.cpp


示例9: DelDir

 void DelDir(const std::string& in_dir_name, bool del_this)
 {
     try{
         boost::filesystem::path path_ = boost::filesystem::current_path() / in_dir_name;
         boost::filesystem::remove_all(path_);
         //std::cout <<"DelDir\n";
         if (!del_this)
             MakeDir(in_dir_name);
         
     }
     catch(boost::filesystem::filesystem_error e)
     {
         //std::cout <<"DelDir crash\n";
     }
     
 }
开发者ID:huangyt,项目名称:MyProjects,代码行数:16,代码来源:FileControl.cpp


示例10: MakeDir

static void MakeDir (const char* name)
{
  struct stat stats;
  if (stat (name, &stats) == 0)
    return;

  const char* bslash = strrchr (name, '\\');
  if (!bslash)
    return;
  const size_t len = bslash - name;
  csString upPath;
  upPath.Append (name, len);

  MakeDir (upPath);
  CreateDirectoryA (name, 0);
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:16,代码来源:filesysconfig.cpp


示例11: switch

int CFileZillaApi::Command(t_command *pCommand)
{
	//Check if call allowed
	if (!m_bInitialized)
		return FZ_REPLY_NOTINITIALIZED;

	//Dispatch command to command specific functions
	switch(pCommand->id)
	{
	case FZ_COMMAND_LIST:
		if (pCommand->param1!=_MPT(""))
			return List(pCommand->path,pCommand->param1,pCommand->param4);
		else if (!pCommand->path.IsEmpty())
			return List(pCommand->path,pCommand->param4);
		else
			return List(pCommand->param4);
		break;
	case FZ_COMMAND_CONNECT:
		return Connect(pCommand->server);
		break;
	case FZ_COMMAND_DISCONNECT:
		return Disconnect();
		break;
	case FZ_COMMAND_FILETRANSFER:
		return FileTransfer(pCommand->transferfile);
		break;
	case FZ_COMMAND_DELETE:
		return Delete(pCommand->param1, pCommand->path);
		break;
	case FZ_COMMAND_REMOVEDIR:
		return RemoveDir(pCommand->param1, pCommand->path);
		break;
	case FZ_COMMAND_MAKEDIR:
		return MakeDir(pCommand->path);
		break;
	case FZ_COMMAND_RENAME:
		return Rename(pCommand->param1, pCommand->param2, pCommand->path, pCommand->newPath);
		break;
	case FZ_COMMAND_CUSTOMCOMMAND:
		return CustomCommand(pCommand->param1);
		break;
	case FZ_COMMAND_CHMOD:
		return Chmod(pCommand->param4, pCommand->param1, pCommand->path);
		break;
	}
	return FZ_REPLY_INVALIDPARAM;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:47,代码来源:FileZillaApi.cpp


示例12: CreateLogFile

/******************************************************************************
 * Function Name: CreateLogFile
 *
 * Inputs       : eLogFile
 * Outputs      : -
 * Returns      : 
 * Globals Used : -
 *
 * Description  : 
 *****************************************************************************/
IMG_INTERNAL IMG_BOOL CreateLogFile(LogFile eLogFile, IMG_CHAR *pszFileName)
{
	FILE     *LogFile = NULL;
	IMG_BOOL  bChangedToLogFileDir = IMG_FALSE;

	if (eLogFile >= LOGFILE_LAST_LOG_FILE)
	{
		return IMG_FALSE;
	}

	if(ChangeDir("logfiles"))
	{
		if ( MakeDir("logfiles") == 0)
		{
			ChangeDir("logfiles");
			bChangedToLogFileDir = IMG_TRUE;
		}
		else
		{
			bChangedToLogFileDir = IMG_FALSE;
		}
	}
	else
	{
		bChangedToLogFileDir = IMG_TRUE;
	}

	if (pszFileName)
	{
		LogFile = fopen(pszFileName, "wc");
	}

	if (bChangedToLogFileDir)
	{
		ChangeDir("..");
	}

	gLogFiles[eLogFile] = LogFile;

	if (!LogFile)
	{
		DEBUG_MESSAGE(("CreateLogFile: Failed to create logfile \n"));
		return IMG_FALSE;
	}

	return IMG_TRUE;
}
开发者ID:aosp,项目名称:gfx_linux_ddk,代码行数:57,代码来源:glsldebug.c


示例13: return

tstring CConfig::GetBkCfgFilePath() const
{
#ifdef _WIN32
    tstring strPath = ::GetAppDir();
    return ( strPath + CONFIG_BK_FILE ).c_str();
#elif defined ( __SYMBIAN32__ )
	
	return _T( "e:\\mcu\\mcucfgbk.xml" );
#else
    tstring strPath = _T( "/usr/share/mcu/" );
    if( !IsFileExist( strPath.c_str() ) )
    {
        MakeDir( strPath.c_str() );
    }
    return  ( strPath + CONFIG_BK_FILE ).c_str();
#endif
}
开发者ID:dalinhuang,项目名称:ffmpeg-port,代码行数:17,代码来源:mcuconfig.cpp


示例14: csGetPlatformConfig

csPtr<iConfigFile> csGetPlatformConfig (const char* Key)
{
  csString path = csGetPlatformConfigPath (Key);
  path << ".cfg";

  size_t bslash = path.FindLast ('\\');
  if (bslash != (size_t)-1)
    path[bslash] = 0;
  // @@@ Would be nicer if this was only done when the config file is really 
  // saved to disk.
  MakeDir (path.GetData());
  if (bslash != (size_t)-1)
    path[bslash] = '\\';

  // Create/read a config file; okay if missing; will be created when written
  return new csConfigFile (path);
}
开发者ID:GameLemur,项目名称:Crystal-Space,代码行数:17,代码来源:filesysconfig.cpp


示例15: RegisterSession

static	void
RegisterSession(
	SessionData	*data)
{
	SessionCtrl *ctrl;
ENTER_FUNC;
	snprintf(data->hdr->tempdir,SIZE_PATH,"%s/%s",TempDirRoot,data->hdr->uuid);
	if (!MakeDir(data->hdr->tempdir,0700)) {
		Error("cannot make session tempdir %s",data->hdr->tempdir);
	}

	ctrl = NewSessionCtrl(SESSION_CONTROL_INSERT);
	ctrl->session = data;
	SessionEnqueue(ctrl);
	ctrl = (SessionCtrl*)DeQueue(ctrl->waitq);
	FreeSessionCtrl(ctrl);
LEAVE_FUNC;
}
开发者ID:authorNari,项目名称:panda,代码行数:18,代码来源:termthread.c


示例16: MakeDir

// 设置本地缓存目录
bool LCVideoManager::SetDirPath(const string& dirPath)
{
	bool result = false;

	if (!dirPath.empty())
	{
		m_dirPath = dirPath;
		if (m_dirPath.at(m_dirPath.length()-1) != '/'
			&& m_dirPath.at(m_dirPath.length()-1) != '\\')
		{
			m_dirPath += "/";
		}
        
        // 创建目录
        result = MakeDir(m_dirPath);
	}
	return result;
}
开发者ID:KingsleyYau,项目名称:common-c-library,代码行数:19,代码来源:LCVideoManager.cpp


示例17: lua_makeDir

static int lua_makeDir(lua_State* L)
{
    int res = false;
    int top = 0;
    const char* path = NULL;

    top = lua_gettop(L);
    jn2Exit0(top == 1);

    path = lua_tostring(L, 1);
    jn2Exit0(path);

    res = MakeDir(path);
    lua_pushboolean(L, res);
    return 1;
Exit0:
    return 0;
}
开发者ID:antiwb3,项目名称:code,代码行数:18,代码来源:luapath.cpp


示例18: GetAppDataPath

bool GetAppDataPath(wchar *Path,size_t MaxSize,bool Create)
{
  LPMALLOC g_pMalloc;
  SHGetMalloc(&g_pMalloc);
  LPITEMIDLIST ppidl;
  *Path=0;
  bool Success=false;
  if (SHGetSpecialFolderLocation(NULL,CSIDL_APPDATA,&ppidl)==NOERROR &&
      SHGetPathFromIDList(ppidl,Path) && *Path!=0)
  {
    AddEndSlash(Path,MaxSize);
    wcsncatz(Path,L"WinRAR",MaxSize);
    Success=FileExist(Path);
    if (!Success && Create)
      Success=MakeDir(Path,false,0)==MKDIR_SUCCESS;
  }
  g_pMalloc->Free(ppidl);
  return Success;
}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:19,代码来源:pathfn.cpp


示例19: TestMakeMultDif

/** Tests the creation of a directory with 2 threads accessing different directories 
	(the current and one with 300 files)

	@param aSelector Configuration in case of manual execution
*/
LOCAL_C TInt TestMakeMultDif(TAny* aSelector)
	{
	TInt i = 100;
	TBuf16<50> directory;
	TBuf16<50> dirtemp;
	TInt testStep;
	
	Validate(aSelector);

	CreateDirWithNFiles(300,3);		
			
	directory = gSessionPath;
	dirtemp.Format(KDirMultipleName2, 3, 300);
	directory.Append(dirtemp);
	gDelEntryDir2 = directory;

	test.Printf(_L("#~TS_Title_%d,%d: MkDir with mult clients accessing dif dirs, RFs::MkDir\n"), gTestHarness, gTestCase);
	
	i = 100;
	testStep = 1;
	while(i <= KMaxFiles)
		{	
		if(i == 100 || i == 1000 || i == 5000 || i == 10000)
			{
			directory = gSessionPath;
			dirtemp.Format(KDirMultipleName2, 2, i);
			directory.Append(dirtemp);
			gDelEntryDir = directory;

			DoTest2(DeleteEntryAccess);

			MakeDir(i, testStep++);	

			DoTestKill();
			}
		i += 100;
		}

	gTestCase++;
	return(KErrNone);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:46,代码来源:t_fsrmkdir.cpp


示例20: LocalTime

// Initialize tiny log
TINY_LOG *NewTinyLog()
{
	char name[MAX_PATH];
	SYSTEMTIME st;
	TINY_LOG *t;

	LocalTime(&st);

	MakeDir(TINY_LOG_DIRNAME);

	Format(name, sizeof(name), TINY_LOG_FILENAME,
		st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);

	t = ZeroMalloc(sizeof(TINY_LOG));

	StrCpy(t->FileName, sizeof(t->FileName), name);
	t->io = FileCreate(name);
	t->Lock = NewLock();

	return t;
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:22,代码来源:Cedar.c



注:本文中的MakeDir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MakeFrameName函数代码示例发布时间:2022-05-30
下一篇:
C++ MakeDelegate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap