VTK  9.1.0
vtkPSystemTools.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPSystemTools.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14 =========================================================================*/
26#ifndef vtkPSystemTools_h
27#define vtkPSystemTools_h
28
29#include "vtkObject.h"
30#include "vtkParallelCoreModule.h" // For export macro
31#include <string> // for string functions in SystemTools
32
33class VTKPARALLELCORE_EXPORT vtkPSystemTools : public vtkObject
34{
35public:
37 vtkTypeMacro(vtkPSystemTools, vtkObject);
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
46 static void BroadcastString(std::string&, int proc);
47
55 static VTK_FILEPATH std::string CollapseFullPath(VTK_FILEPATH const std::string& in_relative);
56 static VTK_FILEPATH std::string CollapseFullPath(
57 VTK_FILEPATH const std::string& in_relative, VTK_FILEPATH const char* in_base);
58
60
68 static bool FileExists(VTK_FILEPATH const char* filename, bool isFile);
69 static bool FileExists(VTK_FILEPATH const std::string& filename, bool isFile);
70 static bool FileExists(VTK_FILEPATH const char* filename);
71 static bool FileExists(VTK_FILEPATH const std::string& filename);
73
77 static bool FileIsDirectory(VTK_FILEPATH const std::string& name);
78
91 static bool FindProgramPath(const char* argv0, std::string& pathOut, std::string& errorMsg,
92 const char* exeName = nullptr, const char* buildDir = nullptr,
93 const char* installPrefix = nullptr);
94
98 static VTK_FILEPATH std::string GetCurrentWorkingDirectory(bool collapse = true);
99
105 static VTK_FILEPATH std::string GetProgramPath(VTK_FILEPATH const std::string&);
106
107protected:
108 vtkPSystemTools() = default;
109 ~vtkPSystemTools() override = default;
110
111private:
112 vtkPSystemTools(const vtkPSystemTools&) = delete;
113 void operator=(const vtkPSystemTools&) = delete;
114};
115
116#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82
System tools for file system introspection.
static void BroadcastString(std::string &, int proc)
Given a string on process proc, broadcast that string to all of the other processes.
vtkPSystemTools()=default
static bool FileIsDirectory(VTK_FILEPATH const std::string &name)
Return true if the file is a directory.
static bool FileExists(VTK_FILEPATH const std::string &filename)
Return true if a file exists in the current directory.
static VTK_FILEPATH std::string GetProgramPath(VTK_FILEPATH const std::string &)
Given the path to a program executable, get the directory part of the path with the file stripped off...
static vtkPSystemTools * New()
~vtkPSystemTools() override=default
static VTK_FILEPATH std::string CollapseFullPath(VTK_FILEPATH const std::string &in_relative, VTK_FILEPATH const char *in_base)
static bool FileExists(VTK_FILEPATH const char *filename)
Return true if a file exists in the current directory.
static VTK_FILEPATH std::string CollapseFullPath(VTK_FILEPATH const std::string &in_relative)
Given a path to a file or directory, convert it to a full path.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static VTK_FILEPATH std::string GetCurrentWorkingDirectory(bool collapse=true)
Get current working directory CWD.
static bool FileExists(VTK_FILEPATH const std::string &filename, bool isFile)
Return true if a file exists in the current directory.
static bool FindProgramPath(const char *argv0, std::string &pathOut, std::string &errorMsg, const char *exeName=nullptr, const char *buildDir=nullptr, const char *installPrefix=nullptr)
Given argv[0] for a unix program find the full path to a running executable.
static bool FileExists(VTK_FILEPATH const char *filename, bool isFile)
Return true if a file exists in the current directory.
#define VTK_FILEPATH