3131
3232-- Path can be in any format recognized by the extractor at oozPath, ie,
3333-- a .ggpk file or a Steam Path of Exile directory
34- local GGPKClass = newClass (" GGPKData" , function (self , path , datPath )
34+ local GGPKClass = newClass (" GGPKData" , function (self , path , datPath , reExport )
3535 if datPath then
3636 self .oozPath = datPath :match (" \\ $" ) and datPath or (datPath .. " \\ " )
3737 else
3838 self .path = path
3939 self .oozPath = io.popen (" cd" ):read (' *l' ):gsub (' \r ?' , ' ' ) .. " \\ ggpk\\ "
40- self :CleanDir ()
41- self :ExtractFiles ()
40+ self :CleanDir (reExport )
41+ self :ExtractFiles (reExport )
4242 end
4343
4444 self .dat = { }
@@ -51,10 +51,12 @@ local GGPKClass = newClass("GGPKData", function(self, path, datPath)
5151 end
5252end )
5353
54- function GGPKClass :CleanDir ()
55- local cmd = ' del ' .. self .oozPath .. ' Data ' .. self .oozPath .. ' Metadata /Q /S'
56- ConPrintf (cmd )
57- os.execute (cmd )
54+ function GGPKClass :CleanDir (reExport )
55+ if reExport then
56+ local cmd = ' del ' .. self .oozPath .. ' Data ' .. self .oozPath .. ' Metadata /Q /S'
57+ ConPrintf (cmd )
58+ os.execute (cmd )
59+ end
5860end
5961
6062function GGPKClass :ExtractFilesWithBun (fileListStr )
@@ -63,45 +65,47 @@ function GGPKClass:ExtractFilesWithBun(fileListStr)
6365 os.execute (cmd )
6466end
6567
66- function GGPKClass :ExtractFiles ()
67- local datList , txtList , itList = self :GetNeededFiles ()
68- local sweetSpotCharacter = 6000
69- local fileList = ' '
70- for _ , fname in ipairs (datList ) do
71- if USE_DAT64 then
72- fileList = fileList .. ' "' .. fname .. ' c64" '
73- else
74- fileList = fileList .. ' "' .. fname .. ' " '
75- end
68+ function GGPKClass :ExtractFiles (reExport )
69+ if reExport then
70+ local datList , txtList , itList = self :GetNeededFiles ()
71+ local sweetSpotCharacter = 6000
72+ local fileList = ' '
73+ for _ , fname in ipairs (datList ) do
74+ if USE_DAT64 then
75+ fileList = fileList .. ' "' .. fname .. ' c64" '
76+ else
77+ fileList = fileList .. ' "' .. fname .. ' " '
78+ end
7679
77- if fileList :len () > sweetSpotCharacter then
78- self :ExtractFilesWithBun (fileList )
79- fileList = ' '
80+ if fileList :len () > sweetSpotCharacter then
81+ self :ExtractFilesWithBun (fileList )
82+ fileList = ' '
83+ end
8084 end
81- end
8285
83- for _ , fname in ipairs (txtList ) do
84- fileList = fileList .. ' "' .. fname .. ' " '
86+ for _ , fname in ipairs (txtList ) do
87+ fileList = fileList .. ' "' .. fname .. ' " '
8588
86- if fileList :len () > sweetSpotCharacter then
87- self :ExtractFilesWithBun (fileList )
88- fileList = ' '
89+ if fileList :len () > sweetSpotCharacter then
90+ self :ExtractFilesWithBun (fileList )
91+ fileList = ' '
92+ end
8993 end
90- end
9194
92- for _ , fname in ipairs (itList ) do
93- fileList = fileList .. ' "' .. fname .. ' " '
95+ for _ , fname in ipairs (itList ) do
96+ fileList = fileList .. ' "' .. fname .. ' " '
97+
98+ if fileList :len () > sweetSpotCharacter then
99+ self :ExtractFilesWithBun (fileList )
100+ fileList = ' '
101+ end
102+ end
94103
95- if fileList :len () > sweetSpotCharacter then
104+ if ( fileList :len () > 0 ) then
96105 self :ExtractFilesWithBun (fileList )
97- fileList = ' '
98106 end
99107 end
100108
101- if (fileList :len () > 0 ) then
102- self :ExtractFilesWithBun (fileList )
103- end
104-
105109 -- Overwrite Enums
106110 local errMsg = PLoadModule (" Scripts/enums.lua" )
107111 if errMsg then
0 commit comments