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