funexpected / godot-flash-module

MIT License
39 stars 3 forks source link

Is there a sample zfl file to test with ? #12

Closed Michaelwhite34 closed 1 year ago

Michaelwhite34 commented 1 year ago

I am using godot 3.5, flash-tools creates a fnx.export folder of 7.76 mb and zfl of 1kb. I am not sure if the export is right with the 1kb size, when I load zfl in Flashplayer's Resource panel, nothing happens. Can someone post an example file so that I can test what's causing the problem ?

Michaelwhite34 commented 1 year ago

I zipped the fnx.export folder and change the extension to zfl, it crashes godot.

Michaelwhite34 commented 1 year ago

solved by using the python script import os import sys import zipfile

class Compress: def init(self, source, destination): self.source = source self.destination = destination

def execute(self):
    with zipfile.ZipFile(self.destination, 'w', compression=zipfile.ZIP_DEFLATED) as zipf:
        for root, dirs, files in os.walk(self.source):
            for file in files:
                file_path = os.path.join(root, file)
                arcname = os.path.relpath(file_path, self.source)
                zipf.write(file_path, arcname=arcname)

def decompress(path, outdir): with zipfile.ZipFile(path, 'r') as zipf: zipf.extractall(outdir)

def get_output_zip_name(source_folder): folder_name = os.path.basename(source_folder) return folder_name + '.zip'

if name == 'main': if len(sys.argv) < 2: print("Please provide a folder path as a command-line argument.") sys.exit(1)

source_folder = sys.argv[1]
output_zip_name = get_output_zip_name(source_folder)
output_zip_path = os.path.join(os.path.dirname(sys.argv[0]), output_zip_name)

compress = Compress(source=source_folder, destination=output_zip_path)
compress.execute()
Michaelwhite34 commented 1 year ago

The problem might be that 7-zip and bandizip work differently from this method.