2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 // start of shared cmdlib stuff
29 #include "globaldefs.h"
33 // TTimo started adding portability code:
34 // return true if spawning was successful, false otherwise
35 // on win32 we have a bCreateConsole flag to create a new console or run inside the current one
36 //boolean Q_Exec(const char* pCmd, boolean bCreateConsole);
37 // execute a system command:
38 // cmd: the command to run
39 // cmdline: the command line
40 // NOTE TTimo following are win32 specific:
41 // execdir: the directory to execute in
42 // bCreateConsole: spawn a new console or not
44 // if the spawn was fine
45 // TODO TTimo add functionality to track the process until it dies
47 bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateConsole, bool waitfor );
49 // some easy portability crap
52 #define access_owner_read 0400
53 #define access_owner_write 0200
54 #define access_owner_execute 0100
55 #define access_owner_rw_ 0600
56 #define access_owner_r_x 0500
57 #define access_owner__wx 0300
58 #define access_owner_rwx 0700
60 #define access_group_read 0040
61 #define access_group_write 0020
62 #define access_group_execute 0010
63 #define access_group_rw_ 0060
64 #define access_group_r_x 0050
65 #define access_group__wx 0030
66 #define access_group_rwx 0070
68 #define access_others_read 0004
69 #define access_others_write 0002
70 #define access_others_execute 0001
71 #define access_others_rw_ 0006
72 #define access_others_r_x 0005
73 #define access_others__wx 0003
74 #define access_others_rwx 0007
77 #define access_rwxrwxr_x ( access_owner_rwx | access_group_rwx | access_others_r_x )
78 #define access_rwxrwxrwx ( access_owner_rwx | access_group_rwx | access_others_rwx )
81 // returns true if succeeded in creating directory
84 inline bool Q_mkdir( const char* name ){
85 return _mkdir( name ) != -1;
89 inline bool Q_mkdir( const char* name ){
90 return mkdir( name, access_rwxrwxr_x ) != -1;
95 inline double Sys_DoubleTime( void ){
96 return clock() / 1000.0;