42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _OSD_Process_HeaderFile |
18 | #define _OSD_Process_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <OSD_Error.hxx> |
aafe169f |
25 | #include <TCollection_AsciiString.hxx> |
26 | |
42cf5bc1 |
27 | class OSD_OSDError; |
42cf5bc1 |
28 | class Quantity_Date; |
29 | class OSD_Path; |
30 | |
9fd2d2c3 |
31 | // undefine SetCurrentDirectory that can be #defined by previous inclusion of windows.h |
32 | #ifdef SetCurrentDirectory |
33 | # undef SetCurrentDirectory |
34 | #endif |
42cf5bc1 |
35 | |
36 | //! A set of system process tools |
37 | class OSD_Process |
38 | { |
39 | public: |
40 | |
aafe169f |
41 | //! Return full path to the current process executable. |
42 | Standard_EXPORT static TCollection_AsciiString ExecutablePath(); |
43 | |
44 | //! Return full path to the folder containing current process executable with trailing separator. |
45 | Standard_EXPORT static TCollection_AsciiString ExecutableFolder(); |
42cf5bc1 |
46 | |
aafe169f |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
42cf5bc1 |
50 | |
51 | //! Initializes the object and prepare for a possible dump |
52 | Standard_EXPORT OSD_Process(); |
53 | |
42cf5bc1 |
54 | //! Returns the terminal used (vt100, vt200 ,sun-cmd ...) |
55 | Standard_EXPORT void TerminalType (TCollection_AsciiString& Name); |
56 | |
57 | //! Gets system date. |
58 | Standard_EXPORT Quantity_Date SystemDate(); |
59 | |
42cf5bc1 |
60 | //! Returns the user name. |
61 | Standard_EXPORT TCollection_AsciiString UserName(); |
62 | |
63 | //! Returns True if the process user is the super-user. |
64 | Standard_EXPORT Standard_Boolean IsSuperUser(); |
65 | |
66 | //! Returns the 'Process Id' |
67 | Standard_EXPORT Standard_Integer ProcessId(); |
68 | |
69 | //! Returns the current path where the process is. |
70 | Standard_EXPORT OSD_Path CurrentDirectory(); |
71 | |
72 | //! Changes the current process directory. |
73 | Standard_EXPORT void SetCurrentDirectory (const OSD_Path& where); |
74 | |
75 | //! Returns TRUE if an error occurs |
76 | Standard_EXPORT Standard_Boolean Failed() const; |
77 | |
78 | //! Resets error counter to zero |
79 | Standard_EXPORT void Reset(); |
80 | |
81 | //! Raises OSD_Error |
82 | Standard_EXPORT void Perror(); |
83 | |
84 | //! Returns error number if 'Failed' is TRUE. |
85 | Standard_EXPORT Standard_Integer Error() const; |
86 | |
42cf5bc1 |
87 | private: |
42cf5bc1 |
88 | OSD_Error myError; |
42cf5bc1 |
89 | }; |
90 | |
42cf5bc1 |
91 | #endif // _OSD_Process_HeaderFile |