10
10
11
11
#include < vector>
12
12
13
+ static void fileCopy (const char * existingFilePath, const char * newFilePath);
14
+
13
15
// 0x452740
14
16
int fileCopyDecompressed (const char * existingFilePath, const char * newFilePath)
15
17
{
@@ -51,7 +53,7 @@ int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
51
53
return -1 ;
52
54
}
53
55
} else {
54
- fileCopy (existingFilePath, newFilePath, true );
56
+ fileCopy (existingFilePath, newFilePath);
55
57
}
56
58
57
59
return 0 ;
@@ -74,7 +76,7 @@ int fileCopyCompressed(const char* existingFilePath, const char* newFilePath)
74
76
// Source file is already gzipped, there is no need to do anything
75
77
// besides copying.
76
78
fclose (inStream);
77
- fileCopy (existingFilePath, newFilePath, true );
79
+ fileCopy (existingFilePath, newFilePath);
78
80
} else {
79
81
gzFile outStream = compat_gzopen (newFilePath, " wb" );
80
82
if (outStream == NULL ) {
@@ -137,15 +139,13 @@ int _gzdecompress_file(const char* existingFilePath, const char* newFilePath)
137
139
gzclose (gzstream);
138
140
fclose (stream);
139
141
} else {
140
- fileCopy (existingFilePath, newFilePath, true );
142
+ fileCopy (existingFilePath, newFilePath);
141
143
}
142
144
143
145
return 0 ;
144
146
}
145
147
146
- // Modelled as replacement for `CopyFileA`, but `overwrite` is the opposite to
147
- // `bFailIfExists` param. Update callers accordingly.
148
- void fileCopy (const char * existingFilePath, const char * newFilePath, bool overwrite)
148
+ static void fileCopy (const char * existingFilePath, const char * newFilePath)
149
149
{
150
150
char nativeExistingFilePath[COMPAT_MAX_PATH];
151
151
strcpy (nativeExistingFilePath, existingFilePath);
@@ -155,16 +155,8 @@ void fileCopy(const char* existingFilePath, const char* newFilePath, bool overwr
155
155
strcpy (nativeNewFilePath, newFilePath);
156
156
compat_windows_path_to_native (nativeNewFilePath);
157
157
158
- char outMode[4 ];
159
- outMode[0 ] = ' w' ;
160
- outMode[1 ] = ' b' ;
161
-
162
- if (!overwrite) {
163
- outMode[2 ] = ' x' ;
164
- }
165
-
166
158
FILE* in = fopen (nativeExistingFilePath, " rb" );
167
- FILE* out = fopen (nativeNewFilePath, outMode );
159
+ FILE* out = fopen (nativeNewFilePath, " wb " );
168
160
if (in != NULL && out != NULL ) {
169
161
std::vector<unsigned char > buffer (0xFFFF );
170
162
0 commit comments