History

a bit batch of #chunreal refactor

Ge Wang committed 3 years ago

Commit 9aac3a41 parent a46220614 files · +195 −124Browse files

Showing the changes to src/core/chuck_parse.cpp (1 of 14 files). Show all

Unified · Split

src/core/chuck_parse.cpp+27−12
@@ -39,8 +39,14 @@ · 38 unmodified lines
39#endif39#endif
40 40
41#ifdef __PLATFORM_WIN32__41#ifdef __PLATFORM_WIN32__
42#include <windows.h> // for win32_tmpfile()42#ifndef __CHUNREAL_ENGINE__
43#endif43 #include <windows.h> // for win32_tmpfile()
44#else
45 // 1.5.0.0 (ge) | #chunreal
46 // unreal engine on windows disallows including windows.h
47 #include "Windows/MinWindows.h"
48#endif // #ifndef __CHUNREAL_ENGINE__
49#endif // #ifdef __PLATFORM_WIN32__
44 50
45using namespace std;51using namespace std;
46 52
@@ -76,44 +82,53 @@ FILE * open_cat_ck( c_str fname ) · 29 unmodified lines
76 }82 }
77#endif // __ANDROID__83#endif // __ANDROID__
78 84
79 FILE * fd = NULL;85 FILE * fd = fopen(fname, "rb");
80 if( !(fd = fopen( fname, "rb" )) )86 if( !fd )
87 {
81 if( !strstr( fname, ".ck" ) && !strstr( fname, ".CK" ) )88 if( !strstr( fname, ".ck" ) && !strstr( fname, ".CK" ) )
82 {89 {
83 strcat( fname, ".ck" );90 strcat( fname, ".ck" );
84 fd = fopen( fname, "rb" );91 fd = fopen( fname, "rb" );
85 }92 }
93 }
86 return fd;94 return fd;
87}95}
88 96
89 97
90 98
99
91//-----------------------------------------------------------------------------100//-----------------------------------------------------------------------------
92// name: win32_tmpfile()101// name: win32_tmpfile()
93// desc: replacement for broken tmpfile() on Windows Vista + 7102// desc: replacement for broken tmpfile() on Windows Vista + 7
94//-----------------------------------------------------------------------------103//-----------------------------------------------------------------------------
95#ifdef __PLATFORM_WIN32__104#ifdef __PLATFORM_WIN32__
96
97#include <windows.h>
98
99FILE *win32_tmpfile()105FILE *win32_tmpfile()
100{106{
101 char tmp_path[MAX_PATH];107 char tmp_path[MAX_PATH];
102 char file_path[MAX_PATH];108 char file_path[MAX_PATH];
103 FILE * file = NULL;109 FILE * file = NULL;
104 110
105 if(GetTempPath(256, tmp_path) == 0)111#ifndef __CHUNREAL_ENGINE__
112 if( GetTempPath(256, tmp_path) == 0 )
113#else
114 // 1.5.0.0 (ge) | #chunreal explicit call ASCII version
115 if( GetTempPathA(256, tmp_path) == 0 )
116#endif
106 return NULL;117 return NULL;
107 118
108 if(GetTempFileName(tmp_path, "mA", 0, file_path) == 0)119#ifndef __CHUNREAL_ENGINE__
120 if( GetTempFileName(tmp_path, "mA", 0, file_path) == 0 )
121#else
122 // 1.5.0.0 (ge) | #chunreal explicit call ASCII version
123 if( GetTempFileNameA(tmp_path, "mA", 0, file_path) == 0 )
124#endif
109 return NULL;125 return NULL;
110 126
111 file = fopen(file_path, "wb+D");127 file = fopen( file_path, "wb+D" );
112 128
113 return file;129 return file;
114}130}
115 131#endif // #ifdef __PLATFORM_WIN32__
116#endif
117 132
118 133
119 134

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t