Skip to content

Commit 34dd13d

Browse files
committed
Build wwtranslatedb on linux
1 parent 53b4d5f commit 34dd13d

2 files changed

Lines changed: 15 additions & 76 deletions

File tree

.github/workflows/openw3d.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
wwmath
5353
wwutil
5454
wwbitpack
55+
wwtranslatedb
5556
shell: bash
5657

5758
steps:

Code/wwtranslatedb/translatedb.cpp

Lines changed: 14 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
#include "translatedb.h"
3939

40-
#include <windows.h>
4140
#include <string.h>
4241

4342
#include "persist.h"
@@ -424,19 +423,9 @@ TranslateDBClass::Export_Table (const char *filename)
424423
//
425424
// Create the file
426425
//
427-
HANDLE file = ::CreateFileA (filename,
428-
GENERIC_WRITE,
429-
0,
430-
NULL,
431-
CREATE_ALWAYS,
432-
0L,
433-
NULL);
434-
435-
WWASSERT (file != INVALID_HANDLE_VALUE);
436-
if (file != INVALID_HANDLE_VALUE) {
437-
438-
TextFileClass file_obj;
439-
file_obj.Attach (file);
426+
TextFileClass file_obj;
427+
file_obj.Open(filename, FileClass::WRITE);
428+
if (file_obj.Is_Open()) {
440429

441430
//
442431
// Loop over all the translation objects and write a tab delimited
@@ -487,12 +476,6 @@ TranslateDBClass::Export_Table (const char *filename)
487476
file_obj.Write_Line (text_entry);
488477
}
489478
}
490-
491-
//
492-
// Close the file
493-
//
494-
file_obj.Detach ();
495-
::CloseHandle (file);
496479
}
497480

498481
return ;
@@ -510,19 +493,9 @@ TranslateDBClass::Export_C_Header (const char *filename)
510493
//
511494
// Create the file
512495
//
513-
HANDLE file = ::CreateFileA (filename,
514-
GENERIC_WRITE,
515-
0,
516-
NULL,
517-
CREATE_ALWAYS,
518-
0L,
519-
NULL);
520-
521-
WWASSERT (file != INVALID_HANDLE_VALUE);
522-
if (file != INVALID_HANDLE_VALUE) {
523-
524-
TextFileClass file_obj;
525-
file_obj.Attach (file);
496+
TextFileClass file_obj;
497+
file_obj.Open(filename, FileClass::WRITE);
498+
if (file_obj.Is_Open()) {
526499

527500
//
528501
// Wtite the 'C' style header framework
@@ -563,12 +536,6 @@ TranslateDBClass::Export_C_Header (const char *filename)
563536
file_obj.Write_Line ("// TRANSLATEDB: End ID Block");
564537
file_obj.Write_Line ("");
565538
file_obj.Write_Line ("#endif //__STRING_IDS_H");
566-
567-
//
568-
// Close the file
569-
//
570-
file_obj.Detach ();
571-
::CloseHandle (file);
572539
}
573540

574541
return ;
@@ -586,19 +553,9 @@ TranslateDBClass::Import_C_Header (const char *filename)
586553
//
587554
// Create the file
588555
//
589-
HANDLE file = ::CreateFileA (filename,
590-
GENERIC_READ,
591-
FILE_SHARE_READ,
592-
NULL,
593-
OPEN_EXISTING,
594-
0L,
595-
NULL);
596-
597-
WWASSERT (file != INVALID_HANDLE_VALUE);
598-
if (file != INVALID_HANDLE_VALUE) {
599-
600-
TextFileClass file_obj;
601-
file_obj.Attach (file);
556+
TextFileClass file_obj;
557+
file_obj.Open(filename, FileClass::READ);
558+
if (file_obj.Is_Open()) {
602559

603560
StringClass line;
604561
bool found_id_block = false;
@@ -684,13 +641,7 @@ TranslateDBClass::Import_C_Header (const char *filename)
684641
found_end_block = (line.Compare_No_Case ("// TRANSLATEDB: End ID Block") == 0);
685642
}
686643
}
687-
}
688-
689-
//
690-
// Close the file
691-
//
692-
file_obj.Detach ();
693-
::CloseHandle (file);
644+
}
694645
}
695646

696647
return ;
@@ -931,7 +882,7 @@ TranslateDBClass::Remove_Object (int index)
931882
if (object != NULL) {
932883
// Remove the object from the hash table
933884
StringClass lower_case_name(object->Get_ID_Desc(),true);
934-
_strlwr(lower_case_name.Peek_Buffer());
885+
lower_case_name.To_Lower();
935886
m_ObjectHash.Remove(lower_case_name);
936887
delete object;
937888
}
@@ -1181,22 +1132,9 @@ TranslateDBClass::Import_Strings (const char *filename)
11811132
//
11821133
// Open the file
11831134
//
1184-
HANDLE file = ::CreateFileA ( filename,
1185-
GENERIC_READ,
1186-
FILE_SHARE_READ,
1187-
NULL,
1188-
OPEN_EXISTING,
1189-
0L,
1190-
NULL);
1191-
1192-
WWASSERT (file != INVALID_HANDLE_VALUE);
1193-
if (file != INVALID_HANDLE_VALUE) {
1194-
1195-
//
1196-
// Attach this file to a text file class for easier parsing
1197-
//
1198-
TextFileClass file_obj;
1199-
file_obj.Attach (file);
1135+
TextFileClass file_obj;
1136+
file_obj.Open(filename, FileClass::READ);
1137+
if (file_obj.Is_Open()) {
12001138

12011139
//
12021140
// Keep reading data from the file until we've reached the end

0 commit comments

Comments
 (0)