summaryrefslogtreecommitdiffhomepage
path: root/Datafile/Main.cpp
diff options
context:
space:
mode:
authorFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-05-28 20:08:13 +0000
committerFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-05-28 20:08:13 +0000
commit9c075563dbfbc3ba56906c6365365cc678ded27e (patch)
tree56cf8907cfd8a46874d53801687ff674216a957d /Datafile/Main.cpp
parent56a3380b46f406ffaf093405ac2db4515b0a4f80 (diff)
downloadstarshatter-9c075563dbfbc3ba56906c6365365cc678ded27e.zip
starshatter-9c075563dbfbc3ba56906c6365365cc678ded27e.tar.gz
starshatter-9c075563dbfbc3ba56906c6365365cc678ded27e.tar.bz2
Updated datafile for compatibility to modern Windows, also changed MAX_FILES to 8192
Diffstat (limited to 'Datafile/Main.cpp')
-rw-r--r--Datafile/Main.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/Datafile/Main.cpp b/Datafile/Main.cpp
index 5920300..23ac306 100644
--- a/Datafile/Main.cpp
+++ b/Datafile/Main.cpp
@@ -25,19 +25,23 @@ void insertFile(DataArchive& a, const char* sPath, WIN32_FIND_DATA* find)
{
char sFile[256];
char sFlat[256];
- char sTemp[256];
+ std::string sTemp;
DWORD find_attrib_forbidden =
FILE_ATTRIBUTE_DIRECTORY |
FILE_ATTRIBUTE_HIDDEN |
FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_OFFLINE;
- if (sPath && *sPath)
- sprintf(sFile, "%s/%s", sPath, find->cFileName);
- else {
- sprintf(sTemp, "%s", find->cFileName);
- strcpy(sFile, sTemp);
- }
+ if (sPath && *sPath) {
+ sTemp = sPath;
+ sTemp += '/';
+ WideCharToMultiByte(CP_ACP,0,find->cFileName,-1, sFile,260, NULL, NULL);
+ sTemp += sFile;
+ strcpy(sFile, sTemp.c_str());
+ } else {
+ WideCharToMultiByte(CP_ACP,0,find->cFileName,-1, sFile,260, NULL, NULL);
+ }
+
if (find->dwFileAttributes & find_attrib_forbidden) {
printf(" Skipping: %-48s \n", sFile);
@@ -132,10 +136,16 @@ void buildFile(DataArchive& a, const char* sPath, WIN32_FIND_DATA& find)
if (find.cFileName[0] == '.') {
} else if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char subdir[256];
- if (sPath && *sPath)
- sprintf(subdir, "%s/%s", sPath, find.cFileName);
+ std::string sTemp;
+ if (sPath && *sPath) {
+ sTemp = sPath;
+ sTemp += '/';
+ WideCharToMultiByte(CP_ACP,0,find.cFileName,-1, subdir,260, NULL, NULL);
+ sTemp += subdir;
+ strcpy(subdir, sTemp.c_str());
+ }
else
- sprintf(subdir, "%s", find.cFileName);
+ WideCharToMultiByte(CP_ACP,0,find.cFileName,-1, subdir,256, NULL, NULL);
build(a, subdir);
} else {
@@ -143,14 +153,6 @@ void buildFile(DataArchive& a, const char* sPath, WIN32_FIND_DATA& find)
}
}
-std::wstring ToWideString(const std::string& str)
-{
- int stringLength = MultiByteToWideChar(CP_ACP, 0, str.data(), str.length(), 0, 0);
- std::wstring wstr(stringLength, 0);
- MultiByteToWideChar(CP_ACP, 0, str.data(), str.length(), &wstr[0], stringLength);
- return wstr;
-}
-
void build(DataArchive& a, const char* sBasePath)
{
char sPath[256];