Skip to content

Fix the up value to match the tree depth of the source file#131

Merged
MartijnCuppens merged 6 commits into
Intracto:masterfrom
JensLuyten:fix-copy-path
Mar 3, 2020
Merged

Fix the up value to match the tree depth of the source file#131
MartijnCuppens merged 6 commits into
Intracto:masterfrom
JensLuyten:fix-copy-path

Conversation

@JensLuyten

Copy link
Copy Markdown
Contributor

When copying files from a source folder into your theme folder structure, the copy command also copied the parent folders the source file was in. This occurs since v0.4.0 of Buildozer.

Example:
copy:
- src: node_modules/bootstrap/dist/js/bootstrap.min.js
dest: source/scripts/all

resulted in the following folder structure:
source/scripts/all/node_modules/bootstrap/dist/js/bootstrap.min.js

By setting the up value to the length of the src path minus 1, only the file is copied into the folder declared in the dest argument of the copy settings. This change will put the file in source/scripts/all/bootstrap.min.js.

@MartijnCuppens

Copy link
Copy Markdown
Contributor

@JensLuyten, can you write a test for this?

@JensLuyten

Copy link
Copy Markdown
Contributor Author

@MartijnCuppens, I have added a test for this copy use-case.

@MartijnCuppens

Copy link
Copy Markdown
Contributor

@JensLuyten, these tests can be combined with the existing test-copy (just combined these).

I've also added some additional tests which show this is still not fixing every case (especially when globbing is used).

@JensLuyten

Copy link
Copy Markdown
Contributor Author

Hi @MartijnCuppens

I've refactored the copy command to be able to work with globbed src definitions. It will now copy files per path rather than per defined location.

Only concern with that one may be performance, but not sure how much it will be affected.

@MartijnCuppens

Copy link
Copy Markdown
Contributor

I've moved the logging to a separate function which is a bit clearer.

Only concern with that one may be performance, but not sure how much it will be affected.

I don't think this will affect performance much.

@JensLuyten

Copy link
Copy Markdown
Contributor Author

Yeah fine, looks a lot cleaner now indeed. :)

@MartijnCuppens MartijnCuppens merged commit 6825f62 into Intracto:master Mar 3, 2020
@MartijnCuppens MartijnCuppens added the bug Something isn't working label Mar 3, 2020
@JensLuyten JensLuyten deleted the fix-copy-path branch August 25, 2021 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants