Skip to content

Commit

Permalink
fix: Ensure the path is properly quoted for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
codematrixer committed Dec 12, 2024
1 parent c0d0753 commit e0bab00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,6 @@ d.swipe_ext(SwipeDirection.DOWN) # 向下滑动

Notes: `swipe_ext``swipe`的区别在于swipe_ext可以指定滑动区域,并且可以指定滑动方向,更简洁灵活

#### 输入
```python
d.input_text(text)

# eg.
d.input_text("adbcdfg")
```
参数`x`, `y`表示输入的位置,`text`表示输入的文本


#### 复杂手势
复杂手势就是手指按下`start`,移动`move`,暂停`pause`的集合,最后运行`action`
Expand Down Expand Up @@ -492,6 +483,16 @@ d.click(x, y)
![Watch the gif](https://i.ibb.co/PC76PRD/gesture.gif)


#### 输入
```python
d.input_text(text)

# eg.
d.input_text("adbcdfg")
```
参数`x`, `y`表示输入的位置,`text`表示输入的文本


## 控件操作

### 常规选择器
Expand Down
6 changes: 4 additions & 2 deletions hmdriver2/hdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _execute_command(cmdargs: Union[str, List[str]]) -> CommandResult:
error = error.decode('utf-8')
exit_code = process.returncode

if 'error:' in output.lower() or '[fail]:' in output.lower():
if 'error:' in output.lower() or '[fail]' in output.lower():
return CommandResult("", output, -1)

return CommandResult(output, error, exit_code)
Expand Down Expand Up @@ -111,7 +111,9 @@ def uninstall(self, bundlename: str):
return result

def install(self, apkpath: str):
quoted_path = shlex.quote(apkpath)
# Ensure the path is properly quoted for Windows
quoted_path = f'"{apkpath}"'

result = _execute_command(f"hdc -t {self.serial} install {quoted_path}")
if result.exit_code != 0:
raise HdcError("HDC install error", result.error)
Expand Down

0 comments on commit e0bab00

Please sign in to comment.