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


C++ wxGetEnv函数代码示例

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


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

示例1: get_pluckerhome_directory

// Looks up the root directory, as needed by get_plucker_directory.
// Don't use this function directly, use a get_plucker_directory() instead.
wxString get_pluckerhome_directory()
{ 
    wxString pluckerhome_directory; 
    
#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
    bool pluckerhome_exists;
    pluckerhome_exists = wxGetEnv( wxT( "PLUCKERHOME" ), &pluckerhome_directory );
    if ( ! pluckerhome_exists ) 
    {
        pluckerhome_directory = wxGetHomeDir() << wxT( "/.plucker" );
    }
#endif  

#ifdef __WXMAC__
    bool pluckerhome_exists;
    pluckerhome_exists = wxGetEnv( wxT( "PLUCKERHOME" ), &pluckerhome_directory );
    if ( ! pluckerhome_exists ) 
    {
        pluckerhome_directory = wxGetHomeDir() << wxT( "/Library/Plucker" );
    }
#endif  

#ifdef __WXMSW__
    bool pluckerhome_exists;
    pluckerhome_exists = wxGetEnv( wxT( "PLUCKERHOME" ), &pluckerhome_directory );
    if ( ! pluckerhome_exists ) 
    {
        pluckerhome_directory = wxGetHomeDir() << wxT( "/Application Data/Plucker" );
    }
#endif  

    return pluckerhome_directory;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker-1,代码行数:35,代码来源:configuration.cpp

示例2: config

void Application::checkEnvironment()
{
    wxString envVar;
    if (wxGetEnv("FR_HOME", &envVar))
        config().setHomePath(translatePathMacros(envVar));
    if (wxGetEnv("FR_USER_HOME", &envVar))
        config().setUserHomePath(translatePathMacros(envVar));
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:8,代码来源:main.cpp

示例3: wxGetEnv

AutoDetectResult CompilerMSVC::AutoDetectInstallationDir()
{
    wxString sep = wxFileName::GetPathSeparator();

    // Read the VCToolkitInstallDir environment variable
    wxGetEnv(_T("VCToolkitInstallDir"), &m_MasterPath);

    if (m_MasterPath.IsEmpty())
    {
        // just a guess; the default installation dir
        wxString Programs = _T("C:\\Program Files");
        // what's the "Program Files" location
        // TO DO : support 64 bit ->    32 bit apps are in "ProgramFiles(x86)"
        //                              64 bit apps are in "ProgramFiles"
        wxGetEnv(_T("ProgramFiles"), &Programs);
        m_MasterPath = Programs + _T("\\Microsoft Visual C++ Toolkit 2003");
    }
    if (!m_MasterPath.IsEmpty())
    {
        AddIncludeDir(m_MasterPath + sep + _T("include"));
        AddLibDir(m_MasterPath + sep + _T("lib"));

#ifdef __WXMSW__
        // add include dirs for MS Platform SDK too
        wxRegKey key; // defaults to HKCR
        key.SetName(_T("HKEY_CURRENT_USER\\Software\\Microsoft\\Win32SDK\\Directories"));
        if (key.Exists() && key.Open(wxRegKey::Read))
        {
            wxString dir;
            key.QueryValue(_T("Install Dir"), dir);
            if (!dir.IsEmpty())
            {
                if (dir.GetChar(dir.Length() - 1) != '\\')
                    dir += sep;
                AddIncludeDir(dir + _T("include"));
                AddLibDir(dir + _T("lib"));
                m_ExtraPaths.Add(dir + _T("bin"));
            }
        }

        // add extra paths for "Debugging tools" too
        key.SetName(_T("HKEY_CURRENT_USER\\Software\\Microsoft\\DebuggingTools"));
        if (key.Exists() && key.Open(wxRegKey::Read))
        {
            wxString dir;
            key.QueryValue(_T("WinDbg"), dir);
            if (!dir.IsEmpty())
            {
                if (dir.GetChar(dir.Length() - 1) == '\\')
                    dir.Remove(dir.Length() - 1, 1);
                m_ExtraPaths.Add(dir);
            }
        }
#endif // __WXMSW__
    }

    return wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
}
开发者ID:Three-DS,项目名称:codeblocks-13.12,代码行数:58,代码来源:compilerMSVC.cpp

示例4: wxSetEnv

void CrtTestCase::SetGetEnv()
{
    wxString val;
    wxSetEnv(_T("TESTVAR"), _T("value"));
    CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val) == true );
    CPPUNIT_ASSERT( val == _T("value") );
    wxSetEnv(_T("TESTVAR"), _T("something else"));
    CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val) );
    CPPUNIT_ASSERT( val == _T("something else") );
    CPPUNIT_ASSERT( wxUnsetEnv(_T("TESTVAR")) );
    CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), NULL) == false );
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:12,代码来源:crt.cpp

示例5: get_temp_dir

wxString
get_temp_dir() {
  wxString temp_dir;

  wxGetEnv(wxT("TMP"), &temp_dir);
  if (temp_dir == wxEmptyString)
    wxGetEnv(wxT("TEMP"), &temp_dir);
  if ((temp_dir == wxEmptyString) && wxDirExists(wxT("/tmp")))
    temp_dir = wxT("/tmp");
  if (temp_dir != wxEmptyString)
    temp_dir += wxT(PATHSEP);

  return temp_dir;
}
开发者ID:ProfOh,项目名称:mkvtoolnix,代码行数:14,代码来源:helpers.cpp

示例6: GetKicadConfigPath

/*
 * GetKicadConfigPath() is taken from KiCad's common.cpp source:
 * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2015 Wayne Stambaugh <[email protected]>
 * Copyright (C) 1992-2015 KiCad Developers
 */
static wxString GetKicadConfigPath()
{
    wxFileName cfgpath;

    // From the wxWidgets wxStandardPaths::GetUserConfigDir() help:
    //      Unix: ~ (the home directory)
    //      Windows: "C:\Documents and Settings\username\Application Data"
    //      Mac: ~/Library/Preferences
    cfgpath.AssignDir( wxStandardPaths::Get().GetUserConfigDir() );

#if !defined( __WINDOWS__ ) && !defined( __WXMAC__ )
    wxString envstr;

    if( !wxGetEnv( wxT( "XDG_CONFIG_HOME" ), &envstr ) || envstr.IsEmpty() )
    {
        // XDG_CONFIG_HOME is not set, so use the fallback
        cfgpath.AppendDir( wxT( ".config" ) );
    }
    else
    {
        // Override the assignment above with XDG_CONFIG_HOME
        cfgpath.AssignDir( envstr );
    }
#endif

    cfgpath.AppendDir( wxT( "kicad" ) );

    if( !cfgpath.DirExists() )
    {
        cfgpath.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
    }

    return cfgpath.GetPath();
}
开发者ID:cbernardo,项目名称:kicad2mcad,代码行数:40,代码来源:kicadpcb.cpp

示例7: defined

bool nsEnvVars::EnvvarVetoUI(const wxString& key, wxCheckListBox* lstEnvVars, int sel)
{
#if defined(TRACE_ENVVARS)
  Manager::Get()->GetLogManager()->DebugLog(F(_T("EnvvarVetoUI")));
#endif

  if (wxGetEnv(key, NULL))
  {
    wxString recursion;
    if (platform::windows) recursion = _T("PATH=%PATH%;C:\\NewPath");
    else                   recursion = _T("PATH=$PATH:/new_path");

    wxString warn_exist;
    warn_exist.Printf(_("Warning: Environment variable '%s' is already set.\n"
                        "Continue with updating it's value?\n"
                        "(Recursions like '%s' will be considered.)"),
                        key.wx_str(), recursion.wx_str());

    if (cbMessageBox(warn_exist, _("Confirmation"),
                     wxYES_NO | wxICON_QUESTION) == wxID_NO)
    {
      if (lstEnvVars && (sel>=0))
        lstEnvVars->Check(sel, false); // Unset to visualise it's NOT set
      return true; // User has vetoed the operation
    }
  }// if

  return false;
}// EnvvarVetoUI
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:29,代码来源:envvars_common.cpp

示例8: wxExpandEnvVars

const wxString S3D_MASTER::GetShape3DFullFilename()
{

    wxString shapeName;

    // Expand any environment variables embedded in footprint's m_Shape3DName field.
    // To ensure compatibility with most of footprint's m_Shape3DName field,
    // if the m_Shape3DName is not an absolute path the default path
    // given by the environment variable KISYS3DMOD will be used

    if( m_Shape3DName.StartsWith( wxT("${") ) )
        shapeName = wxExpandEnvVars( m_Shape3DName );
    else
        shapeName = m_Shape3DName;

    wxFileName fn( shapeName );

    if( fn.IsAbsolute() || shapeName.StartsWith( wxT(".") ) )
        return shapeName;

    wxString default_path;
    wxGetEnv( KISYS3DMOD, &default_path );

    if( default_path.IsEmpty() )
        return shapeName;

    if( !default_path.EndsWith( wxT("/") ) && !default_path.EndsWith( wxT("\\") ) )
        default_path += wxT("/");

    default_path += shapeName;

    return default_path;
}
开发者ID:natsfr,项目名称:kicad,代码行数:33,代码来源:3d_read_mesh.cpp

示例9: set_lib_env_var

/// Extend LIB_ENV_VAR list with the directory from which I came, prepending it.
static void set_lib_env_var( const wxString& aAbsoluteArgv0 )
{
    // POLICY CHOICE 2: Keep same path, so that installer MAY put the
    // "subsidiary DSOs" in the same directory as the kiway top process modules.
    // A subsidiary shared library is one that is not a top level DSO, but rather
    // some shared library that a top level DSO needs to even be loaded.  It is
    // a static link to a shared object from a top level DSO.

    // This directory POLICY CHOICE 2 is not the only dir in play, since LIB_ENV_VAR
    // has numerous path options in it, as does DSO searching on linux, windows, and OSX.
    // See "man ldconfig" on linux. What's being done here is for quick installs
    // into a non-standard place, and especially for Windows users who may not
    // know what the PATH environment variable is or how to set it.

    wxFileName  fn( aAbsoluteArgv0 );

    wxString    ld_path( LIB_ENV_VAR );
    wxString    my_path   = fn.GetPath();
    wxString    new_paths = PrePendPath( ld_path, my_path );

    wxSetEnv( ld_path, new_paths );

#if defined(DEBUG)
    {
        wxString    test;
        wxGetEnv( ld_path, &test );
        printf( "LIB_ENV_VAR:'%s'\n", TO_UTF8( test ) );
    }
#endif
}
开发者ID:corecode,项目名称:kicad-source-mirror,代码行数:31,代码来源:kicad.cpp

示例10: result

wxString EnvironmentConfig::DoExpandVariables(const wxString& in)
{
    wxString result(in);
    wxString varName, text;

    DollarEscaper de(result);
    while ( MacroManager::Instance()->FindVariable(result, varName, text) ) {

        wxString replacement;
        if(varName == wxT("MAKE")) {
            //ignore this variable, since it is probably was passed here
            //by the makefile generator
            replacement = wxT("___MAKE___");

        } else {

            //search for an environment with this name
            wxGetEnv(varName, &replacement);
        }
        result.Replace(text, replacement);
    }

    //restore the ___MAKE___ back to $(MAKE)
    result.Replace(wxT("___MAKE___"), wxT("$(MAKE)"));
    return result;
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:26,代码来源:environmentconfig.cpp

示例11: DisplayInfoMessage

const wxString& PGM_BASE::GetEditorName( bool aCanShowFileChooser )
{
    wxString editorname = m_editor_name;

    if( !editorname )
    {
        if( !wxGetEnv( wxT( "EDITOR" ), &editorname ) )
        {
            // If there is no EDITOR variable set, try the desktop default
#ifdef __WXMAC__
            editorname = "/usr/bin/open";
#elif __WXX11__
            editorname = "/usr/bin/xdg-open";
#endif
        }
    }

    // If we still don't have an editor name show a dialog asking the user to select one
    if( !editorname && aCanShowFileChooser )
    {
        DisplayInfoMessage( NULL,
                            _( "No default editor found, you must choose it" ) );

        editorname = AskUserForPreferredEditor();
    }

    // If we finally have a new editor name request it to be copied to m_editor_name and
    // saved to the preferences file.
    if( !editorname.IsEmpty() )
        SetEditorName( editorname );

    // m_editor_name already has the same value that editorname, or empty if no editor was
    // found/chosen.
    return m_editor_name;
}
开发者ID:ejs-ejs,项目名称:kicad-source-mirror,代码行数:35,代码来源:pgm_base.cpp

示例12: xdg_user_dir_lookup_with_fallback

wxString Path::GetDesktopDir()
{
	char *desktopDir = xdg_user_dir_lookup_with_fallback("DESKTOP", NULL);

	if (desktopDir != NULL)
	{
		wxString desktop = wxString(desktopDir);
		std::cout << "Desktop/XDG: " << desktop << std::endl;
		free (desktopDir);
		return desktop;
	}
	free (desktopDir);
	
	wxString homeDir;

	if (wxGetEnv("HOME", &homeDir))
	{
		wxString desktopDir = Path::Combine(homeDir, "Desktop");
		if(!wxDirExists(desktopDir))
		{
			std::cout << "Using home as a fallback: " << homeDir << std::endl;
			return homeDir;
		}
		else
		{
			std::cout << "Desktop/Guess: " << desktopDir << std::endl;
			return desktopDir;
		}
	}
	else
	{
		std::cout << "Desktop: not found" << std::endl;
		return wxEmptyString;
	}
}
开发者ID:Kuchikixx,项目名称:MultiMC4,代码行数:35,代码来源:apputils.cpp

示例13: PathExpand

bool PathExpand(wxString& cmd)
{
#ifndef __WXMSW__
	if (cmd[0] == '/')
		return true;
#else
	if (cmd[0] == '\\')
		// UNC or root of current working dir, whatever that is
		return true;
	if (cmd.Len() > 2 && cmd[1] == ':')
		// Absolute path
		return true;
#endif

	// Need to search for program in $PATH
	wxString path;
	if (!wxGetEnv(_T("PATH"), &path))
		return false;

	wxString full_cmd;
	bool found = wxFindFileInPath(&full_cmd, path, cmd);
#ifdef __WXMSW__
	if (!found && cmd.Right(4).Lower() != _T(".exe"))
	{
		cmd += _T(".exe");
		found = wxFindFileInPath(&full_cmd, path, cmd);
	}
#endif

	if (!found)
		return false;

	cmd = full_cmd;
	return true;
}
开发者ID:pappacurds,项目名称:filezilla,代码行数:35,代码来源:file_utils.cpp

示例14: CPPUNIT_ASSERT

void EnvTestCase::Path()
{
    wxString contents;
    
    CPPUNIT_ASSERT(wxGetEnv(wxT("PATH"), &contents));
    CPPUNIT_ASSERT(!contents.empty());
}
开发者ID:euler0,项目名称:Helium,代码行数:7,代码来源:environ.cpp

示例15: readlink

wxString wxStandardPaths::GetExecutablePath() const
{
#ifdef __LINUX__
    wxString exeStr;

    char buf[4096];
    int result = readlink("/proc/self/exe", buf, WXSIZEOF(buf) - sizeof(char));
    if ( result != -1 )
    {
        buf[result] = '\0'; // readlink() doesn't NUL-terminate the buffer

        // if the /proc/self/exe symlink has been dropped by the kernel for
        // some reason, then readlink() could also return success but
        // "(deleted)" as link destination...
        if ( strcmp(buf, "(deleted)") != 0 )
            exeStr = wxString(buf, wxConvLibc);
    }

    if ( exeStr.empty() )
    {
        // UPX-specific hack: when using UPX on linux, the kernel will drop the
        // /proc/self/exe link; in this case we try to look for a special
        // environment variable called "   " which is created by UPX to save
        // /proc/self/exe contents. See
        //      http://sf.net/tracker/?func=detail&atid=309863&aid=1565357&group_id=9863
        // for more information about this issue.
        wxGetEnv(wxT("   "), &exeStr);
    }

    if ( !exeStr.empty() )
        return exeStr;
#endif // __LINUX__

    return wxStandardPathsBase::GetExecutablePath();
}
开发者ID:beanhome,项目名称:dev,代码行数:35,代码来源:stdpaths.cpp


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