2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
23 // start of shared cmdlib stuff
\r
38 #define PATH_MAX 260
\r
41 // some easy portability crap
\r
44 #define Q_mkdir(a,b) _mkdir(a)
\r
46 #include <sys/stat.h>
\r
47 #define Q_mkdir(a,b) mkdir(a,b)
\r
51 typedef bool qboolean;
\r
54 // NOTE TTimo: is this worth anything?
\r
55 #ifndef __BYTEBOOL__
\r
56 #define __BYTEBOOL__
\r
59 typedef enum {false, true} boolean;
\r
61 typedef unsigned char boolean;
\r
64 typedef unsigned char byte;
\r
66 #endif // __BYTEBOOL__
\r
68 void DefaultExtension( char *path, char *extension );
\r
69 void DefaultPath( char *path, char *basepath );
\r
70 void StripFilename( char *path );
\r
71 void StripExtension( char *path );
\r
72 void ExtractFilePath( const char *path, char *dest );
\r
73 void ExtractFileName( const char *path, char *dest );
\r
74 void ExtractFileBase( const char *path, char *dest );
\r
75 void ExtractFileExtension( const char *path, char *dest );
\r
77 \brief create all directories leading to a file path. if you pass a directory, terminate it with a '/'
\r
79 void CreateDirectoryPath (const char *path);
\r
81 short BigShort (short l);
\r
82 short LittleShort (short l);
\r
83 int BigLong (int l);
\r
84 int LittleLong (int l);
\r
85 float BigFloat (float l);
\r
86 float LittleFloat (float l);
\r
87 void *qmalloc (size_t size);
\r
88 void* qblockmalloc(size_t nSize);
\r
90 void ConvertDOSToUnixName( char *dst, const char *src );
\r
92 char* StrDup(char* pStr);
\r
94 char* StrDup(const char* pStr);
\r
96 // TTimo started adding portability code:
\r
97 // return true if spawning was successful, false otherwise
\r
98 // on win32 we have a bCreateConsole flag to create a new console or run inside the current one
\r
99 //boolean Q_Exec(const char* pCmd, boolean bCreateConsole);
\r
100 // execute a system command:
\r
101 // cmd: the command to run
\r
102 // cmdline: the command line
\r
103 // NOTE TTimo following are win32 specific:
\r
104 // execdir: the directory to execute in
\r
105 // bCreateConsole: spawn a new console or not
\r
107 // if the spawn was fine
\r
108 // TODO TTimo add functionality to track the process until it dies
\r
109 bool Q_Exec(const char *cmd, char *cmdline, const char *execdir, bool bCreateConsole);
\r