Changeset 227

Show
Ignore:
Timestamp:
03/18/08 12:47:38 (4 months ago)
Author:
timo
Message:

fix windows compile, it's possible the linux build broke and will need misc tweaks. you need a new GtkR-1.6-deps.zip

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • GtkRadiant/branches/ZeroRadiant/libs/missing.h

    r197 r227  
    3535//   this goes along with str.h and provides various utility classes 
    3636//   and portability defines 
    37 //   the filename is a legecy issue, it would be better to clean that up 
     37//   the file name (missing.h) is a legacy issue, it would be better to clean that up 
    3838//   in a central 'portability' lib 
    3939 
     
    4242 
    4343#ifdef _WIN32 
     44 
     45#include <windows.h> 
    4446#include <direct.h> 
    4547#include <io.h> 
    46  
    47 #define MyCopyFile(a,b) CopyFile(a,b,FALSE) 
    48  
    49 #define S_ISDIR(mode) (mode & _S_IFDIR) 
     48#include <sys/types.h> 
     49#include <sys/stat.h> 
     50 
    5051#define R_OK 04 
    51 #define mymkdir(a,b) _mkdir(a) 
    52  
    53 #else 
    54  
    55 #define MyCopyFile CopyFile 
    56 #define mymkdir(a,b) mkdir(a,b) 
    57  
    58 #endif 
    59  
    60 #ifndef _WIN32 
     52 
     53#else // !_WIN32 
    6154 
    6255// LZ: very ugly hacks 
    63 inline int GetLastError () { return 0; }; 
     56inline int GetLastError() { return 0; }; 
    6457 
    6558// temp stuff 
     
    6760#define VERIFY(a) a; 
    6861int GetFullPathName(const char *lpFileName, int nBufferLength, char *lpBuffer, char **lpFilePart); 
    69 bool CopyFile(const char *lpExistingFileName, const char *lpNewFileName); 
    70 bool CopyTree( const char* source, const char* dest ); 
    7162 
    7263#ifndef APIENTRY 
     
    211202}; 
    212203 
     204class FindFiles { 
     205public: 
     206        FindFiles( const char *directory ); 
     207        ~FindFiles(); 
     208 
     209        const char* NextFile(); 
     210private: 
     211#ifdef _WIN32 
     212        Str                             directory; 
     213        HANDLE                  findHandle; 
     214        WIN32_FIND_DATA findFileData; 
     215#else 
     216#endif 
     217}; 
     218 
     219bool CopyTree( const char* source, const char* dest ); 
     220 
     221typedef enum { 
     222        PATH_FAIL,              // stat call failed (does not exist is likely) 
     223        PATH_DIRECTORY, 
     224        PATH_FILE 
     225} EPathCheck; 
     226 
     227// check a path for existence, return directory / file 
     228EPathCheck CheckFile( const char *path ); 
     229 
     230bool radCreateDirectory( const char *directory ); 
     231bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName ); 
     232 
    213233#endif // _MISSING_H_ 
  • GtkRadiant/branches/ZeroRadiant/plugins/image/bmp.h

    r183 r227  
    3030#define BMP_SIGNATURE_WORD  0x4d42 
    3131 
     32#pragma pack(push) 
    3233#pragma pack(1) 
    33  
    34  
    3534 
    3635typedef struct { 
     
    9796void NewBMP(int width, int height, int bpp, bitmap_t *bit); 
    9897 
    99  
     98#pragma pack(pop) 
    10099 
    101100#endif 
  • GtkRadiant/branches/ZeroRadiant/plugins/image/image.vcproj

    r177 r227  
    1 <?xml version="1.0" ?><VisualStudioProject Name="image" ProjectGUID="{1F9977F6-216F-4AE1-9928-59B72CF31C46}" ProjectType="Visual C++" RootNamespace="image" Version="8.00"> 
     1<?xml version="1.0" encoding="Windows-1252"?> 
     2<VisualStudioProject 
     3        ProjectType="Visual C++" 
     4        Version="8.00" 
     5        Name="image" 
     6        ProjectGUID="{1F9977F6-216F-4AE1-9928-59B72CF31C46}" 
     7        RootNamespace="image" 
     8        > 
    29        <Platforms> 
    3                 <Platform Name="Win32"/> 
     10                <Platform 
     11                        Name="Win32" 
     12                /> 
    413        </Platforms> 
    514        <ToolFiles> 
    615        </ToolFiles> 
    716        <Configurations> 
    8                 <Configuration CharacterSet="2" ConfigurationType="2" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Debug|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules"> 
    9                         <Tool Name="VCPreBuildEventTool"/> 
    10                         <Tool Name="VCCustomBuildTool"/> 
    11                         <Tool Name="VCXMLDataGeneratorTool"/> 
    12                         <Tool Name="VCWebServiceProxyGeneratorTool"/> 
    13                         <Tool Name="VCMIDLTool"/> 
    14                         <Tool AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" BasicRuntimeChecks="3" DebugInformationFormat="4" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" MinimalRebuild="true" Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="3" WarningLevel="3"/> 
    15                         <Tool Name="VCManagedResourceCompilerTool"/> 
    16                         <Tool Name="VCResourceCompilerTool"/> 
    17                         <Tool Name="VCPreLinkEventTool"/> 
    18                         <Tool AdditionalDependencies="jpeg6.lib synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib" AdditionalLibraryDirectories="&quot;$(SolutionDir)\..\libxml2\lib&quot;;&quot;$(SolutionDir)\..\gtk2\lib&quot;;&quot;$(SolutionDir)\build\$(ConfigurationName)\libs&quot;" GenerateDebugInformation="true" ModuleDefinitionFile="image.def" Name="VCLinkerTool" TargetMachine="1"/> 
    19                         <Tool Name="VCALinkTool"/> 
    20                         <Tool Name="VCManifestTool"/> 
    21                         <Tool Name="VCXDCMakeTool"/> 
    22                         <Tool Name="VCBscMakeTool"/> 
    23                         <Tool Name="VCFxCopTool"/> 
    24                         <Tool Name="VCAppVerifierTool"/> 
    25                         <Tool Name="VCWebDeploymentTool"/> 
    26                         <Tool Name="VCPostBuildEventTool"/> 
     17                <Configuration 
     18                        Name="Debug|Win32" 
     19                        OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules" 
     20                        IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" 
     21                        ConfigurationType="2" 
     22                        CharacterSet="2" 
     23                        > 
     24                        <Tool 
     25                                Name="VCPreBuildEventTool" 
     26                        /> 
     27                        <Tool 
     28                                Name="VCCustomBuildTool" 
     29                        /> 
     30                        <Tool 
     31                                Name="VCXMLDataGeneratorTool" 
     32                        /> 
     33                        <Tool 
     34                                Name="VCWebServiceProxyGeneratorTool" 
     35                        /> 
     36                        <Tool 
     37                                Name="VCMIDLTool" 
     38                        /> 
     39                        <Tool 
     40                                Name="VCCLCompilerTool" 
     41                                Optimization="0" 
     42                                AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" 
     43                                PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" 
     44                                MinimalRebuild="true" 
     45                                BasicRuntimeChecks="3" 
     46                                RuntimeLibrary="3" 
     47                                WarningLevel="3" 
     48                                Detect64BitPortabilityProblems="true" 
     49                                DebugInformationFormat="4" 
     50                                DisableSpecificWarnings="4996;4244;4267" 
     51                        /> 
     52                        <Tool 
     53                                Name="VCManagedResourceCompilerTool" 
     54                        /> 
     55                        <Tool 
     56                                Name="VCResourceCompilerTool" 
     57                        /> 
     58                        <Tool 
     59                                Name="VCPreLinkEventTool" 
     60                        /> 
     61                        <Tool 
     62                                Name="VCLinkerTool" 
     63                                AdditionalDependencies=" synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib libjpeg.lib" 
     64                                AdditionalLibraryDirectories="&quot;$(SolutionDir)\..\libxml2\lib&quot;;&quot;$(SolutionDir)\..\gtk2\lib&quot;;&quot;$(SolutionDir)\build\$(ConfigurationName)\libs&quot;;&quot;$(SolutionDir)\..\jpeg-6b&quot;" 
     65                                ModuleDefinitionFile="image.def" 
     66                                GenerateDebugInformation="true" 
     67                                TargetMachine="1" 
     68                        /> 
     69                        <Tool 
     70                                Name="VCALinkTool" 
     71                        /> 
     72                        <Tool 
     73                                Name="VCManifestTool" 
     74                        /> 
     75                        <Tool 
     76                                Name="VCXDCMakeTool" 
     77                        /> 
     78                        <Tool 
     79                                Name="VCBscMakeTool" 
     80                        /> 
     81                        <Tool 
     82                                Name="VCFxCopTool" 
     83                        /> 
     84                        <Tool 
     85                                Name="VCAppVerifierTool" 
     86                        /> 
     87                        <Tool 
     88                                Name="VCWebDeploymentTool" 
     89                        /> 
     90                        <Tool 
     91                                Name="VCPostBuildEventTool" 
     92                        /> 
    2793                </Configuration> 
    28                 <Configuration CharacterSet="2" ConfigurationType="2" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Release|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules" WholeProgramOptimization="1"> 
    29                         <Tool Name="VCPreBuildEventTool"/> 
    30                         <Tool Name="VCCustomBuildTool"/> 
    31                         <Tool Name="VCXMLDataGeneratorTool"/> 
    32                         <Tool Name="VCWebServiceProxyGeneratorTool"/> 
    33                         <Tool Name="VCMIDLTool"/> 
    34                         <Tool AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" DebugInformationFormat="3" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" Name="VCCLCompilerTool" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" WarningLevel="3"/> 
    35                         <Tool Name="VCManagedResourceCompilerTool"/> 
    36                         <Tool Name="VCResourceCompilerTool"/> 
    37                         <Tool Name="VCPreLinkEventTool"/> 
    38                         <Tool AdditionalDependencies="jpeg6.lib synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib" AdditionalLibraryDirectories="&quot;$(SolutionDir)\..\libxml2\lib&quot;;&quot;$(SolutionDir)\..\gtk2\lib&quot;;&quot;$(SolutionDir)\build\$(ConfigurationName)\libs&quot;" EnableCOMDATFolding="2" GenerateDebugInformation="true" ModuleDefinitionFile="image.def" Name="VCLinkerTool" OptimizeReferences="2" TargetMachine="1"/> 
    39                         <Tool Name="VCALinkTool"/> 
    40                         <Tool Name="VCManifestTool"/> 
    41                         <Tool Name="VCXDCMakeTool"/> 
    42                         <Tool Name="VCBscMakeTool"/> 
    43                         <Tool Name="VCFxCopTool"/> 
    44                         <Tool Name="VCAppVerifierTool"/> 
    45                         <Tool Name="VCWebDeploymentTool"/> 
    46                         <Tool Name="VCPostBuildEventTool"/> 
     94                <Configuration 
     95                        Name="Release|Win32" 
     96                        OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)\modules" 
     97                        IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" 
     98                        ConfigurationType="2" 
     99                        CharacterSet="2" 
     100                        WholeProgramOptimization="1" 
     101                        > 
     102                        <Tool 
     103                                Name="VCPreBuildEventTool" 
     104                        /> 
     105                        <Tool 
     106                                Name="VCCustomBuildTool" 
     107                        /> 
     108                        <Tool 
     109                                Name="VCXMLDataGeneratorTool" 
     110                        /> 
     111                        <Tool 
     112                                Name="VCWebServiceProxyGeneratorTool" 
     113                        /> 
     114                        <Tool 
     115                                Name="VCMIDLTool" 
     116                        /> 
     117                        <Tool 
     118                                Name="VCCLCompilerTool" 
     119                                AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" 
     120                                PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" 
     121                                RuntimeLibrary="2" 
     122                                WarningLevel="3" 
     123                                Detect64BitPortabilityProblems="true" 
     124                                DebugInformationFormat="3" 
     125                                DisableSpecificWarnings="4996;4244;4267" 
     126                        /> 
     127                        <Tool 
     128                                Name="VCManagedResourceCompilerTool" 
     129                        /> 
     130                        <Tool 
     131                                Name="VCResourceCompilerTool" 
     132                        /> 
     133                        <Tool 
     134                                Name="VCPreLinkEventTool" 
     135                        /> 
     136                        <Tool 
     137                                Name="VCLinkerTool" 
     138                                AdditionalDependencies="synapse.lib libxml2.lib glib-2.0.lib gobject-2.0.lib libjpeg.lib" 
     139                                AdditionalLibraryDirectories="&quot;$(SolutionDir)\..\libxml2\lib&quot;;&quot;$(SolutionDir)\..\gtk2\lib&quot;;&quot;$(SolutionDir)\build\$(ConfigurationName)\libs&quot;;&quot;$(SolutionDir)\..\jpeg-6b&quot;" 
     140                                ModuleDefinitionFile="image.def" 
     141                                GenerateDebugInformation="true" 
     142                                OptimizeReferences="2" 
     143                                EnableCOMDATFolding="2" 
     144                                TargetMachine="1" 
     145                        /> 
     146                        <Tool 
     147                                Name="VCALinkTool" 
     148                        /> 
     149                        <Tool 
     150                                Name="VCManifestTool" 
     151                        /> 
     152                        <Tool 
     153                                Name="VCXDCMakeTool" 
     154                        /> 
     155                        <Tool 
     156                                Name="VCBscMakeTool" 
     157                        /> 
     158                        <Tool 
     159                                Name="VCFxCopTool" 
     160                        /> 
     161                        <Tool 
     162                                Name="VCAppVerifierTool" 
     163                        /> 
     164                        <Tool 
     165                                Name="VCWebDeploymentTool" 
     166                        /> 
     167                        <Tool 
     168                                Name="VCPostBuildEventTool" 
     169                        /> 
    47170                </Configuration> 
    48171        </Configurations> 
     
    50173        </References> 
    51174        <Files> 
    52                 <Filter Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp" Name="Source Files"> 
    53                         <File RelativePath=".\bmp.cpp"> 
    54                         </File> 
    55                         <File RelativePath=".\image.cpp"> 
    56                         </File> 
    57                         <File RelativePath=".\image.def"> 
    58                         </File> 
    59                         <File RelativePath=".\jpeg.cpp"> 
    60                         </File> 
    61                         <File RelativePath=".\lbmlib.cpp"> 
     175                <Filter 
     176                        Name="Source Files" 
     177                        Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;f90;for;f;fpp" 
     178                        > 
     179                        <File 
     180                                RelativePath=".\bmp.cpp" 
     181                                > 
     182                        </File> 
     183                        <File 
     184                                RelativePath=".\image.cpp" 
     185                                > 
     186                        </File> 
     187                        <File 
     188                                RelativePath=".\image.def" 
     189                                > 
     190                        </File> 
     191                        <File 
     192                                RelativePath=".\jpeg.cpp" 
     193                                > 
     194                                <FileConfiguration 
     195                                        Name="Debug|Win32" 
     196                                        > 
     197                                        <Tool 
     198                                                Name="VCCLCompilerTool" 
     199                                                AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\jpeg-6b&quot;" 
     200                                        /> 
     201                                </FileConfiguration> 
     202                                <FileConfiguration 
     203                                        Name="Release|Win32" 
     204                                        > 
     205                                        <Tool 
     206                                                Name="VCCLCompilerTool" 
     207                                                AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\jpeg-6b&quot;" 
     208                                        /> 
     209                                </FileConfiguration> 
     210                        </File> 
     211                        <File 
     212                                RelativePath=".\lbmlib.cpp" 
     213                                > 
    62214                        </File> 
    63215                </Filter> 
    64                 <Filter Filter="h;hpp;hxx;hm;inl;fi;fd" Name="Header Files"> 
    65                         <File RelativePath=".\bmp.h"> 
    66                         </File> 
    67                         <File RelativePath=".\image.h"> 
    68                         </File> 
    69                         <File RelativePath="..\..\libs\jpeglib.h"> 
    70                         </File> 
    71                         <File RelativePath=".\lbmlib.h"> 
     216                <Filter 
     217                        Name="Header Files" 
     218                        Filter="h;hpp;hxx;hm;inl;fi;fd" 
     219                        > 
     220                        <File 
     221                                RelativePath=".\bmp.h" 
     222                                > 
     223                        </File> 
     224                        <File 
     225                                RelativePath=".\image.h" 
     226                                > 
     227                        </File> 
     228                        <File 
     229                                RelativePath="..\..\libs\jpeglib.h" 
     230                                > 
     231                        </File> 
     232                        <File 
     233                                RelativePath=".\lbmlib.h" 
     234                                > 
    72235                        </File> 
    73236                </Filter> 
    74                 <Filter Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" Name="Resource Files"> 
     237                <Filter 
     238                        Name="Resource Files" 
     239                        Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 
     240                        > 
    75241                </Filter> 
    76242        </Files> 
  • GtkRadiant/branches/ZeroRadiant/plugins/image/jpeg.cpp

    r193 r227  
    3535// 
    3636 
     37#include <stdio.h> 
    3738#include <setjmp.h> 
    3839#include <stdlib.h> 
    39 #include <stdio.h> 
    4040#include <string.h> 
    4141#include <glib.h> 
    4242 
     43extern "C" { 
    4344#include <jpeglib.h> 
    4445#include <jerror.h> 
     46} 
    4547 
    4648#include "image.h" 
  • GtkRadiant/branches/ZeroRadiant/radiant/missing.cpp

    r198 r227  
    3535// 
    3636 
    37 // FIXME: compile on Windows as well 
     37#include "missing.h" 
     38#include "qsysprintf.h" 
     39 
    3840#if defined (__linux__) || defined (__APPLE__) 
    3941 
     
    4547#include <stdlib.h> 
    4648#include <dirent.h> 
    47 #include "missing.h" 
    48 #include "qsysprintf.h" 
    49  
    50 bool CopyFile(const char *lpExistingFileName, const char *lpNewFileName) 
     49 
     50bool radCopyFile(const char *lpExistingFileName, const char *lpNewFileName) 
    5151{ 
    5252  FILE *src, *dst; 
     
    8686} 
    8787 
    88 bool CreateDirectory( const char *directory ) { 
     88bool radCreateDirectory( const char *directory ) { 
    8989        if ( mkdir( directory, 0777 ) == -1 ) { 
    9090                Sys_Printf( "mkdir %s failed\n", directory ); 
    9191                return false; 
    92         } 
    93         return true; 
    94 } 
    95  
    96 bool CopyTree( const char *source, const char *dest ) { 
    97         DIR                             *dir; 
    98         struct dirent   *dirlist; 
    99         struct stat             sbuf; 
    100         Str                             srcEntry; 
    101         Str                             dstEntry; 
    102  
    103         dir = opendir( source ); 
    104         if ( dir != NULL ) { 
    105                 while ( ( dirlist = readdir( dir ) ) != NULL ) { 
    106                         if ( strcmp( dirlist->d_name, "." ) == 0 || strcmp( dirlist->d_name, ".." ) == 0 ) { 
    107                                 continue; 
    108                         } 
    109                         if ( strcmp( dirlist->d_name, ".svn" ) == 0 ) { 
    110                                 continue; 
    111                         } 
    112                         srcEntry = source; 
    113                         srcEntry += "/"; 
    114                         srcEntry += dirlist->d_name; 
    115                         dstEntry = dest; 
    116                         dstEntry += "/"; 
    117                         dstEntry += dirlist->d_name; 
    118                         if ( stat( srcEntry.GetBuffer(), &sbuf ) == -1 ) { 
    119                                 Sys_Printf( "stat %s failed\n", srcEntry.GetBuffer() ); 
    120                         } 
    121                         if ( S_ISDIR( sbuf.st_mode ) ) { 
    122                                 bool ret; 
    123                                 if ( stat( dstEntry.GetBuffer(), &sbuf ) == -1 ) { 
    124                                         ret = CreateDirectory( dstEntry.GetBuffer() ); 
    125                                 } 
    126                                 ret = CopyTree( srcEntry.GetBuffer(), dstEntry.GetBuffer() ); 
    127                                 if ( !ret ) { 
    128                                         return false; 
    129                                 } 
    130                         } else { 
    131                                 Sys_Printf( "copy %s -> %s\n", srcEntry.GetBuffer(), dstEntry.GetBuffer() ); 
    132                                 bool ret = CopyFile( srcEntry.GetBuffer(), dstEntry.GetBuffer() ); 
    133                                 if ( !ret ) { 
    134                                         return false; 
    135                                 } 
    136                         } 
    137                 } 
    138                 closedir( dir ); 
    13992        } 
    14093        return true; 
     
    179132} 
    180133 
     134EPathCheck CheckFile( const char *path ) { 
     135        struct stat             sbuf; 
     136        if ( stat( path, &sbuf ) == -1 ) { 
     137                return PATH_FAIL; 
     138        } 
     139        if ( S_ISDIR( sbuf.st_mode ) ) { 
     140                return PATH_DIRECTORY; 
     141        } 
     142        return PATH_FILE; 
     143} 
     144 
     145#else 
     146 
     147FindFiles::FindFiles( const char *_directory ) { 
     148        directory = _directory; 
     149        findHandle = INVALID_HANDLE_VALUE; 
     150} 
     151 
     152FindFiles::~FindFiles() { 
     153        if ( findHandle != NULL ) { 
     154                FindClose( findHandle ); 
     155        } 
     156} 
     157 
     158const char* FindFiles::NextFile() { 
     159        if ( findHandle == INVALID_HANDLE_VALUE ) { 
     160                findHandle = FindFirstFile( directory.GetBuffer(), &findFileData ); 
     161                if ( findHandle == INVALID_HANDLE_VALUE ) { 
     162                        return NULL; 
     163                } 
     164                return findFileData.cFileName; 
     165        } 
     166        if ( FindNextFile( findHandle, &findFileData ) == 0 ) { 
     167                FindClose( findHandle ); 
     168                return NULL; 
     169        } 
     170        return findFileData.cFileName; 
     171} 
     172 
     173EPathCheck CheckFile( const char *path ) { 
     174        struct _stat sbuf; 
     175        if ( _stat( path, &sbuf ) == -1 ) { 
     176                return PATH_FAIL; 
     177        } 
     178        if ( ( sbuf.st_mode & _S_IFDIR ) != 0 ) { 
     179                return PATH_DIRECTORY; 
     180        } 
     181        return PATH_FILE; 
     182} 
     183 
     184bool radCreateDirectory( const char *directory ) { 
     185        return CreateDirectory( directory, NULL ); 
     186} 
     187 
     188bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName ) { 
     189        return CopyFile( lpExistingFileName, lpNewFileName, FALSE ); 
     190} 
     191 
    181192#endif 
     193 
     194bool CopyTree( const char *source, const char *dest ) { 
     195        Str                             srcEntry; 
     196        Str                             dstEntry; 
     197        const char              *dirname; 
     198        FindFiles               fileScan( source ); 
     199 
     200        while ( ( dirname = fileScan.NextFile() ) != NULL ) { 
     201                if ( strcmp( dirname, "." ) == 0 || strcmp( dirname, ".." ) == 0 ) { 
     202                        continue; 
     203                } 
     204                if ( strcmp( dirname, ".svn" ) == 0 ) { 
     205                        continue; 
     206                } 
     207                srcEntry = source; 
     208                srcEntry += "/"; 
     209                srcEntry += dirname; 
     210                dstEntry = dest; 
     211                dstEntry += "/"; 
     212                dstEntry += dirname; 
     213                switch ( CheckFile( srcEntry.GetBuffer() ) ) { 
     214                        case PATH_DIRECTORY: { 
     215                                if ( CheckFile( dstEntry.GetBuffer() ) == PATH_FAIL ) { 
     216                                        radCreateDirectory( dstEntry.GetBuffer() ); 
     217                                } 
     218                                bool ret; 
     219                                ret = CopyTree( srcEntry.GetBuffer(), dstEntry.GetBuffer() ); 
     220                                if ( !ret ) { 
     221                                        return false; 
     222                                } 
     223                                break; 
     224                        } 
     225                        case PATH_FILE: { 
     226                                Sys_Printf( "copy %s -> %s\n", srcEntry.GetBuffer(), dstEntry.GetBuffer() ); 
     227                                bool ret = radCopyFile( srcEntry.GetBuffer(), dstEntry.GetBuffer() ); 
     228                                if ( !ret ) { 
     229                                        return false; 
     230                                } 
     231                                break; 
     232                        } 
     233                } 
     234        } 
     235        return true; 
     236} 
  • GtkRadiant/branches/ZeroRadiant/radiant/preferences.cpp

    r224 r227  
    32833283void CGameInstall::ScanGames() { 
    32843284        Str                             pakPaths = g_strAppPath.GetBuffer(); 
    3285         DIR                             *dir; 
    3286         struct dirent   *dirlist; 
    32873285        int                             iGame = 0; 
     3286        const char              *dirname; 
    32883287 
    32893288        pakPaths +=     "installs/"; 
    3290         dir = opendir( pakPaths.GetBuffer() ); 
    3291         if ( dir != NULL ) { 
    3292                 while ( ( dirlist = readdir( dir ) ) != NULL ) { 
    3293                         if ( stricmp( dirlist->d_name, Q3_PACK ) == 0 ) { 
    3294                                 m_availGames[ iGame++ ] = GAME_Q3; 
    3295                         } 
    3296                         if ( stricmp( dirlist->d_name, URT_PACK ) == 0 ) { 
    3297                                 m_availGames[ iGame++ ] = GAME_URT; 
    3298                         } 
    3299                         if ( stricmp( dirlist->d_name, UFOAI_PACK ) == 0 ) { 
    3300                                 m_availGames[ iGame++ ] = GAME_UFOAI; 
    3301                         } 
     3289        FindFiles fileScan( pakPaths.GetBuffer() ); 
     3290        while ( ( dirname = fileScan.NextFile() ) != NULL ) { 
     3291                if ( stricmp( dirname, Q3_PACK ) == 0 ) { 
     3292                        m_availGames[ iGame++ ] = GAME_Q3; 
    33023293                } 
    3303                 closedir( dir ); 
     3294                if ( stricmp( dirname, URT_PACK ) == 0 ) { 
     3295                        m_availGames[ iGame++ ] = GAME_URT; 
     3296                }                
    33043297        } 
    33053298} 
     3299 
  • GtkRadiant/branches/ZeroRadiant/radiant/radiant.vcproj

    r179 r227  
    1 <?xml version="1.0" ?><VisualStudioProject Name="radiant" ProjectGUID="{65D02375-63EE-4A8A-9F8E-504B1D5A1D02}" ProjectType="Visual C++" RootNamespace="radiant" Version="8.00"> 
     1<?xml version="1.0" encoding="Windows-1252"?> 
     2<VisualStudioProject 
     3        ProjectType="Visual C++" 
     4        Version="8.00" 
     5        Name="radiant" 
     6        ProjectGUID="{65D02375-63EE-4A8A-9F8E-504B1D5A1D02}" 
     7        RootNamespace="radiant" 
     8        > 
    29        <Platforms> 
    3                 <Platform Name="Win32"/> 
     10                <Platform 
     11                        Name="Win32" 
     12                /> 
    413        </Platforms> 
    514        <ToolFiles> 
    615        </ToolFiles> 
    716        <Configurations> 
    8                 <Configuration CharacterSet="2" ConfigurationType="1" IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" Name="Debug|Win32" OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)"> 
    9                         <Tool Name="VCPreBuildEventTool"/> 
    10                         <Tool Name="VCCustomBuildTool"/> 
    11                         <Tool Name="VCXMLDataGeneratorTool"/> 
    12                         <Tool Name="VCWebServiceProxyGeneratorTool"/> 
    13                         <Tool Name="VCMIDLTool"/> 
    14                         <Tool AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\gtk2\lib\gtk-2.0\include&quot;;&quot;$(SolutionDir)\..\gtk2\lib\gtkglext-1.0\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\gtk-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\include\cairo&quot;;&quot;$(SolutionDir)\..\gtk2\include\pango-1.0&quot;;&quot;$(SolutionDir)\..\gtk2\include\atk-1.0&quot;;&quot;$(SolutionDir)\..\gtk2\include\gtkglext-1.0&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" BasicRuntimeChecks="3" DebugInformationFormat="4" Detect64BitPortabilityProblems="true" DisableSpecificWarnings="4996;4244;4267" MinimalRebuild="true" Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="3" WarningLevel="3"/> 
    15                         <Tool Name="VCManagedResourceCompilerTool"/> 
    16                         <Tool Name="VCResourceCompilerTool"/> 
    17                         <Tool Name="VCPreLinkEventTool"/> 
    18                         <Tool AdditionalDependencies="l_net.lib cmdlib.lib mathlib.lib Wsock32.lib libxml2.lib glib-2.0.lib gobject-2.0.lib gdk-win32-2.0.lib gtk-win32-2.0.lib gtkglext-win32-1.0.lib gdkglext-win32-1.0.lib pango-1.0.lib" AdditionalLibraryDirectories="&quot;$(SolutionDir)\..\libxml2\lib&quot;;&quot;$(SolutionDir)\..\gtk2\lib&quot;;&quot;$(SolutionDir)\build\$(ConfigurationName)\libs&quot;" GenerateDebugInformation="true" Name="VCLinkerTool" TargetMachine="1"/> 
    19                         <Tool Name="VCALinkTool"/> 
    20                         <Tool Name="VCManifestTool"/> 
    21                         <Tool Name="VCXDCMakeTool"/> 
    22                         <Tool Name="VCBscMakeTool"/> 
    23                         <Tool Name="VCFxCopTool"/> 
    24                         <Tool Name="VCAppVerifierTool"/> 
    25                         <Tool Name="VCWebDeploymentTool"/> 
    26                         <Tool Name="VCPostBuildEventTool"/> 
     17                <Configuration 
     18                        Name="Debug|Win32" 
     19                        OutputDirectory="$(SolutionDir)\build\$(ConfigurationName)" 
     20                        IntermediateDirectory="$(SolutionDir)\build\intermediate\$(ConfigurationName)\$(ProjectName)" 
     21                        ConfigurationType="1" 
     22                        CharacterSet="2" 
     23                        > 
     24                        <Tool 
     25                                Name="VCPreBuildEventTool" 
     26                        /> 
     27                        <Tool 
     28                                Name="VCCustomBuildTool" 
     29                        /> 
     30                        <Tool 
     31                                Name="VCXMLDataGeneratorTool" 
     32                        /> 
     33                        <Tool 
     34                                Name="VCWebServiceProxyGeneratorTool" 
     35                        /> 
     36                        <Tool 
     37                                Name="VCMIDLTool" 
     38                        /> 
     39                        <Tool 
     40                                Name="VCCLCompilerTool" 
     41                                Optimization="0" 
     42                                AdditionalIncludeDirectories="&quot;$(SolutionDir)\include&quot;;&quot;$(SolutionDir)\libs&quot;;&quot;$(SolutionDir)\..\STLPort\stlport&quot;;&quot;$(SolutionDir)\..\gtk2\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\glib-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\lib\glib-2.0\include&quot;;&quot;$(SolutionDir)\..\gtk2\lib\gtk-2.0\include&quot;;&quot;$(SolutionDir)\..\gtk2\lib\gtkglext-1.0\include&quot;;&quot;$(SolutionDir)\..\gtk2\include\gtk-2.0&quot;;&quot;$(SolutionDir)\..\gtk2\include\cairo&quot;;&quot;$(SolutionDir)\..\gtk2\include\pango-1.0&quot;;&quot;$(SolutionDir)\..\gtk2\include\atk-1.0&quot;;&quot;$(SolutionDir)\..\gtk2\include\gtkglext-1.0&quot;;&quot;$(SolutionDir)\..\libxml2\include&quot;" 
     43                                PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" 
     44                                MinimalRebuild="true" 
     45                                BasicRuntimeChecks="3" 
     46                                RuntimeLibrary="3" 
     47                                WarningLevel="3" 
     48                                Detect64BitPortabilityProblems="true" 
     49                                DebugInformationFormat="4" 
     50                                DisableSpecificWarnings="4996;4244;4267" 
     51                        /> 
     52                        <Tool 
     53                                Name="VCManagedResourceCompilerTool" 
     54                        /> 
     55                        <Tool 
     56                                Name="VCResourceCompilerTool" 
     57                        /> 
     58                        <Tool 
     59                                Name="VCPreLinkEventTool" 
     60                        /> 
     61                        <Tool 
     62                                Name="VCLinkerTool" 
     63                                AdditionalDependencies="l_net.lib cmdlib.lib mathlib.lib Wsock32.lib libxml2.lib glib-2.0.lib gobject-2.0.lib gdk-win32-2.0.lib gtk-win32-2.0.lib gtkglext-win32-1.0.lib gdkglext-win32-1.