machinateur / android-chrome-tab-transfer

A tool to transfer google chrome tabs from your android phone to your computer using `adb`.
MIT License
91 stars 10 forks source link

Cant create tabs.json #6

Closed samsquanch01 closed 2 years ago

samsquanch01 commented 2 years ago

I think the error is here: Writing json file...

phar://C:/adb/android-chrome-tab-transfer-main/android-chrome-tab-transfer-main/copy-tabs.phar**/tabs.json

This is trying to write tabs.json into a file not a folder,ie directory. Path needs to be changed to phar://C:/adb/android-chrome-tab-transfer-main/android-chrome-tab-transfer-main/tabs.json ?

PS C:\adb\android-chrome-tab-transfer-main\android-chrome-tab-transfer-main> .\copy-tabs.cmd The adb executable is available. Running adb command...

adb -d forward tcp:9222 localabstract:chrome_devtools_remote Downloading tabs from device... http://localhost:9222/json/list Download successful! Decoding data now... Successfully decoded data. Writing json file... phar://C:/adb/android-chrome-tab-transfer-main/android-chrome-tab-transfer-main/copy-tabs.phar/tabs.json Failed to write json file!

In CopyTabsCommand.php line 257:

Failed to write json file!

copy-tabs [-p|--port PORT] [-s|--socket SOCKET] [--] []

PS C:\adb\android-chrome-tab-transfer-main\android-chrome-tab-transfer-main>

machinateur commented 2 years ago

The problem is a side-effect of the command running from inside the .phar file.

https://github.com/machinateur/android-chrome-tab-transfer/blob/fc69a41f84c2e7882db00420498f81cb0286401d/src/Command/CopyTabsCommand.php#L244-L245

As this only goes up two levels, when within the archive, it will end up with the phar file name and also will have the phar:// protocol prepended. Phar archives are read-only, so this will naturally lead to an error.

A fix is supplied in #7.