Exemplo n.º 1
0
/// Gets the current framework directory
wxString ctConfigToolDoc::GetFrameworkDir(bool makeUnix)
{
    wxString path = wxGetApp().GetSettings().m_frameworkDir;
    if (wxGetApp().GetSettings().m_useEnvironmentVariable)
    {
        // Should probably allow other variables
        // to be used, and maybe expand variables within m_frameworkDir
        wxString pathEnv(wxGetenv(wxT("WXWIN")));
        path = pathEnv;
#ifdef __WXMSW__
        if (makeUnix)
            path.Replace(wxT("\\"), wxT("/"));
#endif
    }
    return path;
}
Exemplo n.º 2
0
Arquivo: win32.cpp Projeto: garinh/cs
bool csPlatformStartup(iObjectRegistry* r)
{
  /* Work around QueryPerformanceCounter() issues on multiprocessor systems.
   * @@@ FIXME: until Marten(or someone else) finds a better solution ... 
   */
  SetThreadAffinityMask (GetCurrentThread(), 1);

  /* Mark program as DPI aware on Vista to prevent automatic scaling
     by the system on high resolution screens */
  {
    CS::Platform::Win32::CacheDLL hUser32 ("user32.dll");
    CS_ASSERT (hUser32 != 0);
    LPFNSETPROCESSDPIAWARE SetProcessDPIAware =
      (LPFNSETPROCESSDPIAWARE)GetProcAddress (hUser32, "SetProcessDPIAware");
    if (SetProcessDPIAware) SetProcessDPIAware();
  }
  
  csRef<iCommandLineParser> cmdline (csQueryRegistry<iCommandLineParser> (r));

  csPathsList* pluginpaths = csGetPluginPaths (cmdline->GetAppPath());

  /*
    When it isn't already in the PATH environment,
    the CS directory will be put there in front of all
    other paths.
    The idea is that DLLs required by plugins (e.g. zlib)
    which reside in the CS directory can be found by the
    OS even if the application is somewhere else.
   */
  bool needPATHpatch = true;

#if 0
  // @@@ doesn't seem to work in some cases?
  /*
    WinXP SP 1 has a nice function that does exactly that: setting
    a number of search paths for DLLs. However, it's WinXP SP 1+,
    so we have to check if it's available, and if not, patch the PATH
    env var.
   */
  cswinCacheDLL hKernel32 ("kernel32.dll");
  if (hKernel32 != 0)
  {
    LPFNSETDLLDIRECTORYA SetDllDirectoryA =
      (LPFNSETDLLDIRECTORYA)GetProcAddress (hKernel32, "SetDllDirectoryA");

    if (SetDllDirectoryA)
    {
      csString path;

      for (int i = 0; i < pluginpaths->Length(); i++)
      {
	if (((*pluginpaths)[i].path != 0) && (*((*pluginpaths)[i].path) != 0))
	{
	  path << (*pluginpaths)[i].path;
	  path << ';';
	}
      }

      if (path.Length () > 0) SetDllDirectoryA (path.GetData ());
      needPATHpatch = false;
    }
  }
#endif

  if (needPATHpatch)
  {
    csString pathEnv (getenv("PATH"));
    bool pathChanged = false;

    for (size_t i = 0; i < pluginpaths->Length(); i++)
    {
      // @@@ deal with path recursion here?
      if (AddToPathEnv ((*pluginpaths)[i].path, pathEnv)) pathChanged = true;
    }
    if (pathChanged) SetEnvironmentVariable ("PATH", pathEnv);
  }

  delete pluginpaths;


  csRef<Win32Assistant> a = csPtr<Win32Assistant> (new Win32Assistant(r));
  bool ok = r->Register (static_cast<iWin32Assistant*>(a), "iWin32Assistant");
  if (ok)
  {
    assistants.Push (a);
  }
  else
  {
    SystemFatalError ("Failed to register iWin32Assistant!");
  }

  return ok;
}