Skip to content

Improve handling of TwbT graphics files #8

@Pidgeot

Description

@Pidgeot

Unfortunately the installation of TwbT graphics files in 0.13a (from 18b83e) does not work.

  • the function points to nonexistent paths, and so doesn't copy anything at all
  • string replacement on paths is unsafe; we should use os.path.relpath instead

[Issue created by Former user: 2018-09-01]
[Last updated on bitbucket: 2018-09-17]

[Comment created by Pidgeot: 2018-09-01]
Any chance you could paste the error log for reference?

[Comment created by PeridexisErrant: 2018-09-01]
There's no error log, it just doesn't copy the files under data/art/ and data/init/.

for folder in ['graphics', 'objects']:
    # twbt_folder = paths.get('graphics', pack, 'raw', 'twbt_'+folder)
    twbt_folder = paths.get(folder, '..', 'twbt_'+folder)  # I think this is the subdirs of 'raw', right?
    target_folder = paths.get(folder)
    for path, _, files in os.walk(twbt_folder):
        for f in files:
            twbt_f = os.path.join(path, f)
            # target_f = os.path.join(target_folder, os.path.relpath(twbt_f, twbt_folder))
            target_f = twbt_f.replace(twbt_folder, target_folder)
            shutil.copyfile(twbt_f, target_f)

[Comment created by Pidgeot: 2018-09-01]
Ah, yeah, it might be looking in the wrong folder. Oops.

@PeridexisErrant: If you want to make that change you're suggesting in the commented out code, feel free; I can push out a new build easily if this gets fixed. If not, I'll try to take a closer look in a few days (when I have time to investigate a bit more).

[Comment created by PeridexisErrant: 2018-09-01]
I've been meaning to take a close look at this since late July so you might still get there first; the comments are a start but it'll need some investigation and more importantly a quick test-drive!

[Comment created by Pidgeot: 2018-09-17]
So I finally got a chance to look into it, and yeah, I goofed horribly. My bad.

I've double-checked everything this time, and it definitely works now. I'll push the change and start the builds straight away (0.13b).

[Comment created by Pidgeot: 2018-09-17]
Fix TWBT file replacement handling (fixes #159)
Bump version number to 0.13b

→ <>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions