diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-12-05 21:21:03 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-12-05 21:25:09 +0100 |
commit | 7a84898331792d2c1d84e77a1dedb618e1b3c992 (patch) | |
tree | 8ea57c4af8629de038e95c0f6ce469095e702646 /tools/lpgen/lpgen.js | |
parent | d339eb2474a3343602aacc09276235e3110aaf5f (diff) |
lpgen.js: Read version.h as UTF-8 file
Diffstat (limited to 'tools/lpgen/lpgen.js')
-rw-r--r-- | tools/lpgen/lpgen.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/lpgen/lpgen.js b/tools/lpgen/lpgen.js index 4149762b3c..d73fc6a819 100644 --- a/tools/lpgen/lpgen.js +++ b/tools/lpgen/lpgen.js @@ -494,6 +494,18 @@ if (!test1 && !test2 && !test3 && !test4) { }
};
+function ReadWholeFile(path, codepage) {
+ if (codepage === undefined) codepage = "UTF-8";
+ var bs = WScript.CreateObject("ADODB.Stream")
+ bs.Type = 2; //FileReadTypes.adTypeText;
+ bs.CharSet = codepage;
+ bs.Open();
+ bs.LoadFromFile(path);
+ var what = bs.ReadText;
+ bs.Close();
+ return what;
+}
+
//Parse Version.h file to get one translated string from "Description" and make a plugin template header.
function ParseVersion_h (pluginfolder,array) {
//cleanup var
@@ -508,7 +520,7 @@ if (FSO.FileExists(FSO.BuildPath(pluginfolder,"src\\version.h"))) VersionFile=FS //If we still not found version.h, return
if (!VersionFile) return;
//read file fully into var allstrings
-allstrings=ReadFile(VersionFile)
+allstrings=ReadWholeFile(VersionFile);
//define RegExp for defines.
var filename=/(?:#define\s+_*?FILENAME\s+")(.+)(?=")/m;
var pluginname=/(?:#define\s+_*?PLUG(?:IN)?_?NAME\s+")(.+)(?=")/i;
|