当前位置: 首页>>代码示例>>C++>>正文


C++ CurrentDir函数代码示例

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


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

示例1: GetDefInterfaceName

STRPTR GetDefInterfaceName(int argc, char **argv)
{
struct DiskObject *dobj;
struct WBStartup *wbs;
struct WBArg *wbarg;
STRPTR icname;
STRPTR iname;

	if (argc == 0)
	{
		wbs = (struct WBStartup *)argv;
		wbarg = wbs->sm_ArgList;
		icname = wbarg[0].wa_Name;
		CurrentDir(wbarg[0].wa_Lock);
	}
	else
		icname = argv[0];	

	if( !(dobj = GetDiskObject(icname)) )
	{
		CurrentDir(NULL);
		return(NULL);
	}	
		
	iname = FindToolType(dobj->do_ToolTypes, "INTERFACE");
	FreeDiskObject(dobj);
	CurrentDir(NULL);
	return(iname);
}
开发者ID:gfazioli,项目名称:Assembly-Library,代码行数:29,代码来源:GETDEFIN.C

示例2: main

    int main(int argc, char** argv)
    {
        func_args args;

#ifdef HAVE_CAVIUM
        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
        if (ret != 0)
            err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

        StartTCP();

        args.argc = argc;
        args.argv = argv;

        CyaSSL_Init();
#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
        CyaSSL_Debugging_ON();
#endif
        if (CurrentDir("client") || CurrentDir("build"))
            ChangeDirBack(2);
  
#ifdef HAVE_STACK_SIZE
        StackSizeCheck(&args, client_test);
#else 
        client_test(&args);
#endif
        CyaSSL_Cleanup();

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif
        return args.return_code;
    }
开发者ID:Coderz333,项目名称:cyassl,代码行数:34,代码来源:client.c

示例3: MYDEBUG

eOSState cCMDDir::New(void)
{
  MYDEBUG("Verzeichnis: Neu");
  cFileInfo *info = new cFileInfo(CurrentDir());
  if(!info->isWriteable())
  {
    MYDEBUG("Verzeichnis: Neu: Keine Berechtigung in %s", CurrentDir());
    OSD_ERRMSG(tr("no rights to create"));
  }
  else
  {
    State = csDirNew;
    SetCols(5);
    SetTitle(CurrentDir());
    SetDir();

    cMainMenuItem *mItem = (cMainMenuItem*)First();
    Ins(new cMenuEditStrItem(tr("New"), Dir, MaxFileName, trVDR(FileNameChars)),
        true,
        mItem);
    while(mItem)
    {
      mItem->SetSelectable(false);
      mItem = (cMainMenuItem*)Next(mItem);
    }
    Display();
    cOsdMenu::ProcessKey(kRight);
  }

  return osContinue;
}
开发者ID:suborb,项目名称:reelvdr,代码行数:31,代码来源:commands.c

示例4: main

    int main(int argc, char** argv)
    {
        func_args args;

#ifdef HAVE_CAVIUM
        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
        if (ret != 0)
            err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

        StartTCP();

        args.argc = argc;
        args.argv = argv;

        CyaSSL_Init();
#ifdef DEBUG_CYASSL
        CyaSSL_Debugging_ON();
#endif
        if (CurrentDir("echoclient") || CurrentDir("build"))
            ChangeDirBack(2);
        echoclient_test(&args);
        CyaSSL_Cleanup();

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif
        return args.return_code;
    }
开发者ID:JoakimSoderberg,项目名称:cyassl,代码行数:29,代码来源:echoclient.c

示例5: simulated_chdir

static int simulated_chdir(char *name) {
  int result = -1;
  BPTR lock = Lock(name, ACCESS_READ);
  if (lock != NULL) {
    /* Change the current working directory (CWD) of the task
     */
    BPTR old_lock = CurrentDir(lock);

    /* Attempt to update internal buffer of the process.
       If we are not running in a process, but a plain task, this
       call does not cause any harm.
    */
    /* FIXME: What's the result of SetCurrentDirName() in a plain
       task? If it is FALSE, the below code won't work.
    */
    if (SetCurrentDirName(name)) {
      /* If this was successful, unlock `old_lock' because we
	 are not going to restore it later; this routine is one
	 of the few cases where such behavior is appropriate.
      */
      UnLock(old_lock);
      result = 0;
    }
    else {
      /* If it fails, restore the previous CWD and make the
	 whole routine fail.
      */
      CurrentDir(old_lock);
    }
  }
  return result;
}
开发者ID:Imhotup,项目名称:Liberty,代码行数:32,代码来源:directory.c

示例6: main

    int main(int argc, char** argv)
    {
        func_args args;

#ifdef HAVE_CAVIUM
        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
        if (ret != 0)
            err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

        StartTCP();

        args.argc = argc;
        args.argv = argv;

        CyaSSL_Init();
#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
        CyaSSL_Debugging_ON();
#endif
        if (CurrentDir("echoserver"))
            ChangeDirBack(2);
        else if (CurrentDir("Debug") || CurrentDir("Release"))
            ChangeDirBack(3);
        echoserver_test(&args);
        CyaSSL_Cleanup();

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif
        return args.return_code;
    }
开发者ID:Eppo791906066,项目名称:cyassl,代码行数:31,代码来源:echoserver.c

示例7: SwitchCurrentdir

BOOL SwitchCurrentdir( STRPTR path, BPTR * where, BPTR * old )
{
	/* set the CurrentDir before extracting */
	
	if((*where) == 0)
	{
		// the function wasn't used previously, lock then
		
		(*where) = Lock( path, SHARED_LOCK );
		
		if(!(*where)) {
			PrintError("cannot lock selected drawer !?");
			return FALSE;
		}
		
		(*old) = CurrentDir((*where));
	}
	else
	{
		CurrentDir((*old));
		UnLock((*where));
	}
	
	return TRUE;
}
开发者ID:diegocr,项目名称:7zUI,代码行数:25,代码来源:7zUtils.c

示例8: save_contents

/******************************************************************
 Save the contents of a given mail
*******************************************************************/
static void save_contents(struct Read_Data *data, struct mail *mail)
{
	if (!mail->num_multiparts)
	{
		if (MUI_AslRequestTags(data->file_req,
					mail->filename?ASLFR_InitialFile:TAG_IGNORE,mail->filename,
					TAG_DONE))
		{
			BPTR dlock;
			STRPTR drawer = data->file_req->fr_Drawer;

			mail_decode(mail);

			if ((dlock = Lock(drawer,ACCESS_READ)))
			{
				BPTR olock;
				BPTR fh;

				olock = CurrentDir(dlock);

				if ((fh = Open(data->file_req->fr_File, MODE_NEWFILE)))
				{
					Write(fh,mail->decoded_data,mail->decoded_len);
					Close(fh);
				}

				CurrentDir(olock);
				UnLock(dlock);
			}
		}
	}
}
开发者ID:sba1,项目名称:simplemail,代码行数:35,代码来源:readwnd.c

示例9: RenameFile

   void RenameFile (const std::string& srcName, const std::string& dstName, const std::string& path, bool removeExisting)
   {
      if (srcName.empty())      throw error::InvalidParam("No source file name specified!", ERROR_LOCATION);
      else if (dstName.empty()) throw error::InvalidParam("No destination file name specified!", ERROR_LOCATION);

      const std::string srcPath((path.empty()) ? (CurrentDir() + "\\" + srcName) : (path + "\\" + srcName));
      const std::string dstPath((path.empty()) ? (CurrentDir() + "\\" + dstName) : (path + "\\" + dstName));

      MoveFile(srcPath, dstPath, removeExisting);
   }
开发者ID:cppisfun,项目名称:GameEngine,代码行数:10,代码来源:File.cpp

示例10: NATDECLFUNC_5

ULONG NATDECLFUNC_5(GUI_Open, d0, ULONG, cpu, a0, UBYTE *, ProgramName, a1, struct WBArg *, IconName, a2, CONST_STRPTR, vstring, a6, struct DnetcLibrary *, LibBase)
{
	DECLARG_5(d0, ULONG, cpu, a0, UBYTE *, ProgramName, a1, struct WBArg *, IconName, a2, CONST_STRPTR, vstring, a6, struct DnetcLibrary *, LibBase)

	ULONG	sigmask;

	(void)ProgramName;
	(void)cpu;

	if (!LibBase->dobj)
	{
		if (IconName)
		{
			BPTR olddir;

			olddir = CurrentDir(IconName->wa_Lock);
			LibBase->dobj	= GetDiskObject(IconName->wa_Name);
			CurrentDir(olddir);
		}
	}

	sigmask	= 0;

	ObtainSemaphore(&LibBase->SemaphoreGUI);

	if (!LibBase->App)
	{
		Object	*app;

		strcpy(LibBase->Version, vstring);

		app	= NewObjectA(LibBase->AppMCC->mcc_Class, NULL, NULL);

		if (app)
		{
			LibBase->App			= app;
			LibBase->OwnerTask	= FindTask(NULL);

			DoMethod(app, MUIM_MyApplication_OpenMainWindow);

			sigmask	= 0xffff0000;
		}
	}

	ReleaseSemaphore(&LibBase->SemaphoreGUI);

	return sigmask;
}
开发者ID:bovine,项目名称:dnetc-client-base,代码行数:48,代码来源:MUIGUI.c

示例11: NonRecursiveFileEnumerator

bool FileEnumerator::MoveNext()
{
  bool result = false;
  if (!m_StartupDir.empty())
  {
    if (m_CurrentNonRecursiveEnumerator == NULL)
      m_CurrentNonRecursiveEnumerator = new NonRecursiveFileEnumerator(NULL, m_StartupDir.c_str());
    // Enter directory if mode is recursive
    if ((m_Flags & DIRENUM_RECURSIVE_MODE) != 0 && 
      !m_CurrentNonRecursiveEnumerator->Bof() && 
      !m_CurrentNonRecursiveEnumerator->Eof() && 
      IsDir(CurrentPath()))
    {
      //std::string s = m_EntriesEnumerator->StartupDir();
      std::string s = JoinPath(CurrentDir(), m_CurrentNonRecursiveEnumerator->CurrentFileName());
      m_CurrentNonRecursiveEnumerator = new NonRecursiveFileEnumerator(m_CurrentNonRecursiveEnumerator, s.c_str());
    }
    // Find next entry
    result = m_CurrentNonRecursiveEnumerator->MoveNext();
    while (!result && m_CurrentNonRecursiveEnumerator->Parent() != NULL)
    {
      // Go to the parent directory
      NonRecursiveFileEnumerator* p = m_CurrentNonRecursiveEnumerator;
      m_CurrentNonRecursiveEnumerator = p->Parent();
      delete p;
      result = m_CurrentNonRecursiveEnumerator->MoveNext();
    }
    m_Flags &= ~DIRENUM_CURRENT_CACHED;
  }
  return result;
}
开发者ID:gekola,项目名称:BSUIR-labs,代码行数:31,代码来源:FileUtils.cpp

示例12: __exitcommandline

void __exitcommandline(void)
{
  struct WBStartup *wbs=_WBenchMsg;

  if (wbs!=NULL)
  { BPTR file;
    if((file=window)!=0) {
      SelectOutput(output);
      SelectInput(input);
      PPCClose(file);
    }
    if(wbs->sm_ArgList!=NULL) { // set original lock
      UnLock(CurrentDir(cd));
    }
  }
  else
  {
    char *cl=cline;

    if(cl!=NULL)
    { char **av=__argv;

      if(av!=NULL)
      { 
        PPCFreeVec(av);
      }
      PPCFreeVec(cl);
    }
  }
}
开发者ID:bovine,项目名称:dnetc-client-base,代码行数:30,代码来源:amSupport.c

示例13: GetDriveDirectory

//-------------------------------------------------------------
// Pre     : If bCreateIntermediates is TRUE, create all eventually
//           missing parent directories too
// Post    : Return TRUE on success
// Task    : Create new directory
//-------------------------------------------------------------
bool CPath::DirectoryCreate(bool bCreateIntermediates /*= TRUE*/)
{
    std::string	PathText;
    bool	bSuccess;

    GetDriveDirectory(PathText);
    StripTrailingBackslash(PathText);
    bSuccess =::CreateDirectory(PathText.c_str(),NULL) != 0;
    if(!bSuccess)
    {
        CPath CurrentDir(CPath::CURRENT_DIRECTORY);
        bSuccess = ChangeDirectory() != 0;
        CurrentDir.ChangeDirectory();
    }

    if(!bSuccess && bCreateIntermediates)
    {
        std::string::size_type nDelimiter =PathText.rfind(DIRECTORY_DELIMITER);
        if(nDelimiter == std::string::npos)
            return FALSE;

        PathText.resize(nDelimiter + 1);
        CPath SubPath(PathText);

        if (SubPath.DirectoryCreate())
            return DirectoryCreate(false);
        else
            return FALSE;
    }

    return bSuccess;
}
开发者ID:Watilin,项目名称:project64,代码行数:38,代码来源:path.cpp

示例14: ChangeDirToRoot

/* This function changes the current directory to the wolfssl root */
static void ChangeDirToRoot(void)
{
    /* Normal Command Line=_build, Visual Studio=testsuite */
    if (CurrentDir("testsuite") || CurrentDir("_build")) {
        ChangeDirBack(1);
    }

    /* Xcode: To output application to correct location: */
    /* 1. Xcode->Preferences->Locations->Locations */
    /* 2. Derived Data Advanced -> Custom */
    /* 3. Relative to Workspace, Build/Products */
    /* Build/Products/Debug or Build/Products/Release */
    else if (CurrentDir("Debug") || CurrentDir("Release")) {
    ChangeDirBack(5);
    }
}
开发者ID:randombit,项目名称:hacrypto,代码行数:17,代码来源:testsuite.c

示例15: __exitcommandline

void __exitcommandline(void)
{ struct WBStartup *wbs=_WBenchMsg;

  if(wbs!=NULL)
  { BPTR file;
    if((file=window)!=0l)
      Close(file);
    if(wbs->sm_ArgList!=NULL) /* set original lock */
      UnLock(CurrentDir(cd));
  }else
  { char *cl=cline;

    if(cl!=NULL)
    { char **av=__argv;

      if(av!=NULL)
      { 
        if(*av!=NULL)
          FreeVec(*av);
        FreeVec(av);
      }
      FreeVec(cl);
    }
  }
}
开发者ID:Peruonto,项目名称:HXCFE_Amiga_file_selector,代码行数:25,代码来源:__nocommandline.c


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