1 // Created on: 2018-03-15
2 // Created by: Stephan GARNAUD (ARM)
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _OSD_Process_HeaderFile
18 #define _OSD_Process_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <OSD_Error.hxx>
25 #include <TCollection_AsciiString.hxx>
31 // undefine SetCurrentDirectory that can be #defined by previous inclusion of windows.h
32 #ifdef SetCurrentDirectory
33 # undef SetCurrentDirectory
36 //! A set of system process tools
41 //! Return full path to the current process executable.
42 Standard_EXPORT static TCollection_AsciiString ExecutablePath();
44 //! Return full path to the folder containing current process executable with trailing separator.
45 Standard_EXPORT static TCollection_AsciiString ExecutableFolder();
51 //! Initializes the object and prepare for a possible dump
52 Standard_EXPORT OSD_Process();
54 //! Returns the terminal used (vt100, vt200 ,sun-cmd ...)
55 Standard_EXPORT void TerminalType (TCollection_AsciiString& Name);
58 Standard_EXPORT Quantity_Date SystemDate();
60 //! Returns the user name.
61 Standard_EXPORT TCollection_AsciiString UserName();
63 //! Returns True if the process user is the super-user.
64 Standard_EXPORT Standard_Boolean IsSuperUser();
66 //! Returns the 'Process Id'
67 Standard_EXPORT Standard_Integer ProcessId();
69 //! Returns the current path where the process is.
70 Standard_EXPORT OSD_Path CurrentDirectory();
72 //! Changes the current process directory.
73 Standard_EXPORT void SetCurrentDirectory (const OSD_Path& where);
75 //! Returns TRUE if an error occurs
76 Standard_EXPORT Standard_Boolean Failed() const;
78 //! Resets error counter to zero
79 Standard_EXPORT void Reset();
82 Standard_EXPORT void Perror();
84 //! Returns error number if 'Failed' is TRUE.
85 Standard_EXPORT Standard_Integer Error() const;
91 #endif // _OSD_Process_HeaderFile