2 Copyright (C) 1999-2007 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
41 // some easy portability crap
44 #define Q_mkdir( a,b ) _mkdir( a )
47 #define Q_mkdir( a,b ) mkdir( a,b )
51 typedef bool qboolean;
54 // NOTE TTimo: is this worth anything?
59 typedef enum {false, true} boolean;
61 typedef unsigned char boolean;
64 typedef unsigned char byte;
66 #endif // __BYTEBOOL__
68 void DefaultExtension( char *path, char *extension );
69 void DefaultPath( char *path, char *basepath );
70 void StripFilename( char *path );
71 void StripExtension( char *path );
72 void ExtractFilePath( const char *path, char *dest );
73 void ExtractFileName( const char *path, char *dest );
74 void ExtractFileBase( const char *path, char *dest );
75 void ExtractFileExtension( const char *path, char *dest );
77 \brief create all directories leading to a file path. if you pass a directory, terminate it with a '/'
79 void CreateDirectoryPath( const char *path );
81 short BigShort( short l );
82 short LittleShort( short l );
84 int LittleLong( int l );
85 float BigFloat( float l );
86 float LittleFloat( float l );
87 void *qmalloc( size_t size );
88 void* qblockmalloc( size_t nSize );
90 void ConvertDOSToUnixName( char *dst, const char *src );
92 char* StrDup( char* pStr );
94 char* StrDup( const char* pStr );
96 // TTimo started adding portability code:
97 // return true if spawning was successful, false otherwise
98 // on win32 we have a bCreateConsole flag to create a new console or run inside the current one
99 //boolean Q_Exec(const char* pCmd, boolean bCreateConsole);
100 // execute a system command:
101 // cmd: the command to run
102 // cmdline: the command line
103 // NOTE TTimo following are win32 specific:
104 // execdir: the directory to execute in
105 // bCreateConsole: spawn a new console or not
107 // if the spawn was fine
108 // TODO TTimo add functionality to track the process until it dies
109 bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateConsole );