mirror of
https://github.com/google/adb-sync.git
synced 2026-01-03 09:58:01 +00:00
Use os.fsencode to encode path names from argv to byte strings.
This is the proper way according to https://docs.python.org/3/library/os.html#file-names-command-line-arguments-and-environment-variables Fixes #10. Fixes #18. Fixes #7.
This commit is contained in:
13
adb-sync
13
adb-sync
@@ -762,21 +762,20 @@ def main() -> None:
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help='Do not do anything - just show what would be done.')
|
help='Do not do anything - just show what would be done.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
args_encoding = locale.getdefaultlocale()[1] or 'ascii'
|
|
||||||
|
|
||||||
localpatterns = [x.encode(args_encoding) for x in args.source]
|
localpatterns = [os.fsencode(x) for x in args.source]
|
||||||
remotepath = args.destination.encode(args_encoding)
|
remotepath = os.fsencode(args.destination)
|
||||||
adb_args = args.adb.encode(args_encoding).split(b' ')
|
adb_args = os.fsencode(args.adb).split(b' ')
|
||||||
if args.device:
|
if args.device:
|
||||||
adb_args += [b'-d']
|
adb_args += [b'-d']
|
||||||
if args.emulator:
|
if args.emulator:
|
||||||
adb_args += [b'-e']
|
adb_args += [b'-e']
|
||||||
if args.serial:
|
if args.serial:
|
||||||
adb_args += [b'-s', args.serial.encode(args_encoding)]
|
adb_args += [b'-s', os.fsencode(args.serial)]
|
||||||
if args.host:
|
if args.host:
|
||||||
adb_args += [b'-H', args.host.encode(args_encoding)]
|
adb_args += [b'-H', os.fsencode(args.host)]
|
||||||
if args.port:
|
if args.port:
|
||||||
adb_args += [b'-P', args.port.encode(args_encoding)]
|
adb_args += [b'-P', os.fsencode(args.port)]
|
||||||
adb = AdbFileSystem(adb_args)
|
adb = AdbFileSystem(adb_args)
|
||||||
|
|
||||||
# Expand wildcards, but only on the remote side.
|
# Expand wildcards, but only on the remote side.
|
||||||
|
|||||||
Reference in New Issue
Block a user