Skip to content

"push" method from device fails while pushing folders recursively #54

@iblancasa

Description

@iblancasa

Description of the issue

The push method from the Device class has an small bug when pushing folders recursively. This is the structure of the folder I want to push:

/home/israel/resource
├── dtd
│   └── test1.dtd
└── xml
    ├── test1.xml
    ├── test2.xml
    ├── testAttrEnvVar.xml
    └── testEnvVar.xml

This is how I'm calling the method:

device.push("/home/israel/resource", "/sdcard")

The previous situations raises:

RuntimeError: ERROR: 'FAIL' +

Cause:

The cause is located in this loop:

            for root, dirs, files in os.walk(src):
                root_dir_path = os.path.join(basename, root.replace(src, ""))

First iteration:

src = /tmp/tmp0s3s470s/rtixmlTester/resource
basename = resource
root = /tmp/tmp0s3s470s/rtixmlTester/resource
root_dir_path = resource/

Second iteration:

src = /tmp/tmp0s3s470s/rtixmlTester/resource
basename = resource
root = /tmp/tmp0s3s470s/rtixmlTester/resource/xml
root_dir_path = /xml

The value for root_dir_path is wrong and should be resource/xml.

Workaround:

A "quick" fix is to just add / to the end of the src parameter:

device.push("/home/israel/resource/", "/sdcard")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions