FrodeSolheim / python-lhafile

LHA archive support for Python
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

Wrong Path Separator from Some Archives. #14

Open TurtleWilly opened 20 hours ago

TurtleWilly commented 20 hours ago

Inspecting various archives I get mixed up path separators. For some archives it uses the expected slash ("/"), but for some other archives I get a backslash ("\"). Shouldn't this be transparently handled?

E.g. I download this archive: http://files.exotica.org.uk/?file=exotica/media%2Faudio%2FUnExoticA%2FGame%2FSeifert_Hannes%2F1869.lha (from: https://www.exotica.org.uk/wiki/1869)

    lha = lhafile.Lhafile("1869.lha")
    files = [info.filename for info in lha.infolist()]

    for filename in files:
        print(filename)

Result:

1869\mod.franzoesisch
1869\mod.karibik
1869\mod.news
1869\mod.russen
1869\mod.schiffsuntergang
1869\mod.schottisch
1869\mod.seemannsgarn
1869\mod.suedamis
1869\mod.taverne
1869\mod.werft
1869\AGA_Version\mod.schiffsuntergang
1869\AGA_Version\mod.schottisch
1869\AGA_Version\mod.seemannsgarn
1869\AGA_Version\mod.suedamis
1869\AGA_Version\mod.taverne
1869\AGA_Version\mod.werft
1869\AGA_Version\mod.europa
1869\AGA_Version\mod.franzoesisch
1869\AGA_Version\mod.gefahr
1869\AGA_Version\mod.indien
1869\AGA_Version\mod.karibik
1869\AGA_Version\mod.news
1869\AGA_Version\mod.russen
1869\AGA_Version\mod.afrika
1869\AGA_Version\mod.amis
1869\AGA_Version\mod.arabia
1869\AGA_Version\mod.bank
1869\AGA_Version\mod.china
1869\AGA_Version\mod.closed
1869\AGA_Version\mod.ehrung
1869\mod.1869 title
1869\mod.afrika
1869\mod.amis
1869\mod.arabia
1869\mod.bank
1869\mod.china
1869\mod.closed
1869\mod.ehrung
1869\mod.europa
1869\mod.gefahr
1869\mod.indien

Not what I expected to see (I'm on macOS and/or Linux). I assume the archive was generated with Windows? Or something else goes wrong here. Other archives (e.g. downloaded from Aminet) behave correctly (I assume those were created on a Unixoid or on Amiga retro machines)

Any idea?