ENH: create a server that does not use vtkPVApplication or tcl wrapping. Move several classes from GUI/Client to Servers/Filters. Remove use of PARAVIEW_NEW_SOURCE_ORGANIZATION define.

This commit is contained in:
Bill Hoffman 2004-08-03 10:20:31 -04:00
parent f3e58aeb7d
commit 2938652cbd
2 changed files with 79 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(ios/fstream)
#include KWSYS_HEADER(ios/sstream)
#ifdef _MSC_VER
# pragma warning (disable: 4786)
@ -1358,6 +1359,64 @@ bool SystemTools::SplitProgramPath(const char* in_name,
return true;
}
bool SystemTools::FindProgramPath(const char* argv0,
kwsys_stl::string& pathOut,
kwsys_stl::string& errorMsg,
const char* exeName,
const char* buildDir,
const char* installPrefix )
{
kwsys_stl::vector<kwsys_stl::string> failures;
kwsys_stl::string self = argv0;
SystemTools::ConvertToUnixSlashes(self);
failures.push_back(argv0);
self = SystemTools::FindProgram(self.c_str());
if(!SystemTools::FileExists(self.c_str()))
{
if(buildDir)
{
kwsys_stl::string intdir = ".";
#ifdef CMAKE_INTDIR
intdir = CMAKE_INTDIR;
#endif
self = buildDir;
self += "/bin/";
self += intdir;
self += "/";
self += exeName;
self += SystemTools::GetExecutableExtension();
}
}
if(installPrefix)
{
if(!SystemTools::FileExists(self.c_str()))
{
failures.push_back(self);
self = installPrefix;
self += "/bin/";
self += exeName;
}
}
if(!SystemTools::FileExists(self.c_str()))
{
failures.push_back(self);
kwsys_ios::ostringstream msg;
msg << "Can not find the command line program " << exeName << "\n";
msg << " argv[0] = \"" << argv0 << "\"\n";
msg << " Attempted paths:\n";
kwsys_stl::vector<kwsys_stl::string>::iterator i;
for(i=failures.begin(); i != failures.end(); ++i)
{
msg << " \"" << i->c_str() << "\"\n";
}
errorMsg = msg.str();
return false;
}
pathOut = self;
return true;
}
kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative)
{
return SystemTools::CollapseFullPath(in_relative, 0);

View File

@ -188,6 +188,26 @@ public:
kwsys_stl::string& file,
bool errorReport = true);
/**
* Given argv[0] for a unix program find the full path to a running
* executable. argv0 can be null for windows WinMain programs
* in this case GetModuleFileName will be used to find the path
* to the running executable. If argv0 is not a full path,
* then this will try to find the full path. If the path is not
* found false is returned, if found true is returned. An error
* message of the attempted paths is stored in errorMsg.
* exeName is the name of the executable.
* buildDir is a possibly null path to the build directory.
* installPrefix is a possibly null pointer to the install directory.
*/
static bool FindProgramPath(const char* argv0,
kwsys_stl::string& pathOut,
kwsys_stl::string& errorMsg,
const char* exeName = 0,
const char* buildDir = 0,
const char* installPrefix = 0);
/**
* Given a path to a file or directory, convert it to a full path.
* This collapses away relative paths relative to the cwd argument